I encounter the pass by value and move idiom quite often: But it seems to me that passing by either const reference or rvalue reference can save a ...
I encounter the pass by value and move idiom quite often: But it seems to me that passing by either const reference or rvalue reference can save a ...
CPP Core guidelines F45 states: Don't return a T&&. I want to create some class, and pass the class through a sequence of functions tha ...
My code is as follows: When I compile the code shown above, I got some compile errors: It seems that the str in B::send function has been changed ...
Let's say I have the function: Is it possible to call this function only with already constructed objects and have Visual Studio throw a compile er ...
Is it a good idea to pass parameters as rvalue references just to make it clear that you're going to manipulate the argument? Kinda like the opposite ...
I am trying to notify user about his medication 3 times daily So I created: let timesPerDay = [] const today = moment(); //not working f ...
I can't fathom the essence of this error so pardon me if the title could be better. This code fails to compile: The faulting line is constexpr int ...
Does the C++ standard guarantee that a failed insertion into an associative container will not modify the rvalue-reference argument? ...
I am creating a class with one array as its private member and getter,setter method for that. I want set a value to that array using an array in main ...
I'm repeatedly running into the problem of accepting a non-const reference parameter, since it seems taking an rvalue parameter prevents accepting lva ...
Consider this example: Is foo<int&&>(i) as fast as foo<int>(i), or does it involve pointer overhead like foo<int&>(i) ...
I just started working with c++11 r-values. I read some tutorials, but I haven't found the answer. What is the best way (the most efficient way) to s ...
I have an idea how to simplify remove code repeats. Please help me to understand if it usable, good, and may be let's upgrade. This call as far ...
If I have a class A and functions the copy constructor is called when returning a from f, but the move constructor is used when returning from g. H ...
When I try to call the move member as pass by reference, the compiler throws an error but when I redefine the member function to pass by value, it wor ...
Consider the following: Needless to say, this code doesn't compile. I realise that I need to use std::move() in the second function call, but for t ...
While implementing a BS Tree, I noticed some things that I wasn't so sure about since I started using C++11 smart pointers and it makes me wonder why ...
So I have a std::map< std::string, boost::any > called OptionsMap and I want to create a function that takes any type (therefore the template) a ...
I have a practice question that has stumped me for an upcoming certification test. Please help anyway that you can! I think I understand how to get th ...
I have a code: Clang++ gives an error: no known conversion from 'int' to 'int &&' for 1st argument Why the i changes its type to int when ...