Consider a struct
template<typename T, size_t N>
struct Something {
std::array<T,N> args;
// Some constructors
};
Now let's overload =
operator for Something<T>
. In fact I can implement it two ways.
First Way
Something& operator=(const Something& rhs){
// an implementation with copy semantics
}
Something& operator=(Something&& rhs) {
// an implementation with move semantics
}
Second Way
Something& operator=(Something rhs){
// implement with move semantics
}
So, my question is what is the most standard way and the most optimal way to do overloading First Way or Second Way?