temporary

create a temporary branch name with git

▼魔方 西西 提交于 2019-12-23 10:59:20
问题 Slightly related to this question I'd like to work with a temporary branch in a shell script. somewhat along the lines of : cd $(git rev-parse --show-toplevel) && git subtree split --prefix=some_subfolder -b temp && git push my_remote temp:publication_branch -f Now, I'm not sure what this will do if the branch temp already exists, in any case I don't want the result on my_remote/publication_branch to depend on that. And I also don't want to modify the branch temp (assuming I have it for

Should this C++ temporary binding to reference member be illegal?

只谈情不闲聊 提交于 2019-12-21 13:09:32
问题 My question (which will follow after this, sorry about the long intro, the question is down there in bold ) is originally inspired by Item 23 in Herb Sutters Exceptional C++ where we find something like this: <snip> ... int main() { GenericTableAlgorithm a( "Customer", MyWorker() ); a.Process(); } with class GenericTableAlgorithm { public: GenericTableAlgorithm( const string& table, GTAClient& worker ); bool Process(); private: struct GenericTableAlgorithmImpl* pimpl_; //implementation };

Reference to an unnamed temporary object (life time)

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-19 08:56:16
问题 After reading this answer from ildjarn, I wrote the following example, and it looks like an unnamed temporary object has the same life time as its reference! How come this is possible? Is it specified in the C++ standard? Which version? Source code: #include <iostream> //cout #include <sstream> //ostringstream int main () { std::ostringstream oss; oss << 1234; std::string const& str = oss.str(); char const* ptr = str.c_str(); // Change the stream content oss << "_more_stuff_"; oss.str(""); /

Fortran runtime warning: temporary array

淺唱寂寞╮ 提交于 2019-12-19 06:00:42
问题 I get the fortran runtime warning "An array temporary was created" when running my code (compiled with gfortran) and I would like to know if there is a better way to solve this warning. My original code is something like this: allocate(flx_est(lsign,3)) allocate(flx_err(lsign,3)) do i=1,lsign call combflx_calc(flx_est(i,:),flx_err(i,:)) enddo Inside the subroutine I define the variables like this: subroutine combflx_calc(flx_est,flx_err) use,intrinsic :: ISO_Fortran_env, only: real64 implicit

Printing a string to a temporary stream object in C++

こ雲淡風輕ζ 提交于 2019-12-18 08:26:21
问题 I have a special type of ostringstream that I am trying to output text to as a temporary object but I'm having some trouble. To be clear, this is essentially what I want to do: ostringstream() << "PARTY DOWN!" << endl; Now before you say: "But Zack, that code is totally worthless! The object is destroyed at the end of the line, how would you even know if it did anything?", hear me out. I don't try to do this with plain ostringstreams, but rather a derived class in which the destructor

Pass temporary object to function that takes pointer

不羁岁月 提交于 2019-12-18 06:14:41
问题 I tried following code : #include<iostream> #include<string> using namespace std; string f1(string s) { return s="f1 called"; } void f2(string *s) { cout<<*s<<endl; } int main() { string str; f2(&f1(str)); } But this code doesn't compile. What I think is : f1 returns by value so it creates temporary, of which I am taking address and passing to f2. Now Please explain me where I am thinking wrong? 回答1: The unary & takes an lvalue (or a function name). Function f1() doesn't return an lvalue, it

C++ function returns a rvalue, but that can be assigned a new value?

落花浮王杯 提交于 2019-12-17 18:57:59
问题 The code is as follows: #include <iostream> using namespace std; class A { }; A rtByValue() { return A(); } void passByRef(A &aRef) { // do nothing } int main() { A aa; rtByValue() = aa; // compile without errors passByRef(rtByValue()); // compile with error return 0; } The g++ compiler gives the following error: d.cpp: In function ‘int main()’: d.cpp:19:23: error: invalid initialization of non-const reference of type ‘A&’ from an rvalue of type ‘A’ d.cpp:12:6: error: in passing argument 1 of

How come a non-const reference cannot bind to a temporary object?

安稳与你 提交于 2019-12-16 18:16:11
问题 Why is it not allowed to get non-const reference to a temporary object, which function getx() returns? Clearly, this is prohibited by C++ Standard but I am interested in the purpose of such restriction, not a reference to the standard. struct X { X& ref() { return *this; } }; X getx() { return X();} void g(X & x) {} int f() { const X& x = getx(); // OK X& x = getx(); // error X& x = getx().ref(); // OK g(getx()); //error g(getx().ref()); //OK return 0; } It is clear that the lifetime of the

How can i clean temp tables on mysql

a 夏天 提交于 2019-12-13 15:26:11
问题 We are creating temp table in procedures and we use no persistent connection for mysql. There are many temp tables is increasing slowly after mysql restart and then the innodb_buffer_pool_size is finishing. The application is working on this server; CPU E3-1245 v5 @ 3.50GHz - 8 core 16GB Ram The image shows tmp tables how increasing is: My.cnf: [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock skip_name_resolve join_buffer_size = 4M sort_buffer_size = 1M read_rnd_buffer_size =

How to use ASP.NET Identity for Temporary Administrator Access [Coming-Soon-Page]

夙愿已清 提交于 2019-12-13 07:05:34
问题 I am creating a new website, and it's already online, but I want to block access to everyone! And just let my client use it to check the development process everyday, so he don't need to download everything and set up on his computer.. I was wondering about using ASP Identity, is there any simple "hack" to achieve this? Or my only way is the following: Add the Register Page to the WebSite Register an account with Administrator role Delete Register Page of the WebSite Use always the same