Having this simple class:
#include <iostream>
class B
{
public:
//default constructor
B(const char* str = "\0") {
std::cout << "Constructor called\n";
}
//copy constructor
B(const B& b) {
std::cout << "Copy constructor called\n";
}
//move constructor
B(B&& b) {
std::cout << "Move constructor called\n";
}
};
What is the difference in terms of move semantics between these statements:
B o1 = B("abc");
B o2 = B(B("abc"));
Are these two lines equivalent?