I'm writing my own vector class (a container for x, y values) and I'm not really sure what constructors/assignment operators I should implement on my own and what I can count on the compiler to provide. Obviously, I need to write any method that doesn't have the default behaviour or isn't auto-generated in any case. But sure enough, there's also no point in implementing something if the compiler can generate the exactly same thing.
I'm using Visual Studio 2010 (which might matter in the aspect of C++11). Also my class is a template one, if that matters.
Currently, I have:
template <typename T>
class Integral2
{
// ...
Integral2(void)
: x(0), y(0)
{}
Integral2(Integral2 && other)
: x(std::move(other.x)), y(std::move(other.y))
{}
Integral2(T _x, T _y)
: x(_x), y(_y)
{}
Integral2 & operator =(Integral2 const & other)
{
x = other.x;
y = other.y;
return *this;
}
Integral2 & operator =(Integral2 && other)
{
x = std::move(other.x);
y = std::move(other.y);
return *this;
}
// ...
};
Do I need copy ctor/assignment operator when I have a move ctor/move operator?