Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ move semantics for `this`

struct S
{
    std::vector<int> data;
    S doStuff() &&
    {
        std::cout << "rvalue
";
        return {std::move(data)};
    }

    S doStuff() const&
    {
        std::cout << "const lvalue
";
        return {data};
    } 
};
Comment

move semantics in c++

void swap(T& a, T& b){
    T temp = std::move(a);
    a = std::move(b);
    b = std::move(temp);
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: stl c++ 
Cpp :: c++ write to csv file append 
Cpp :: function overriding in c++ 
Cpp :: c++ tuple 
Cpp :: strring length in c++ 
Cpp :: c++ random number 
Cpp :: how to format decimal palces in c++ 
Cpp :: c++ program to find lcm of two numbers 
Cpp :: find function in c++ 
Cpp :: cpp get exception type 
Cpp :: string reverse iterator c++ 
Cpp :: data types in c++ 
Cpp :: take a function argument 
Cpp :: c++ check if key exists in map 
Cpp :: how to get euler constant in c++ 
Cpp :: google test assert stdout 
Cpp :: c++ code executio canntot proceed because glew32.dll was not founud 
Cpp :: c++ little endian or big endian 
Cpp :: function c++ example 
Cpp :: c++ while loop 
Cpp :: how to make randomizer c++ 
Cpp :: iomanip header file in c++ 
Cpp :: len in cpp 
Cpp :: C++ Vector Operation Access Elements 
Cpp :: why return 0 in int main 
Cpp :: c++ class constructor variable arguments 
Cpp :: c++ threadpool 
Cpp :: quicksort algorithm 
Cpp :: c++ map vector as keys 
Cpp :: read a file line by line c++ struct site:stackoverflow.com 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =