I have a container class like the following. As you can see that all the resources that the class use is allocated statically. There are no dynamically allocated resources in the class. Does such a class need a move constructor or move assignment operator?
template<class T, std::size_t SIZE>
class Stack{
static_assert(SIZE != 0, "Stack capacity cannot be zero!");
public:
/*** Constructors and Destructor ***/
Stack() = default; // Default constructor
Stack(const Stack& copyStack); // Copy constructor
~Stack(); // Destructor
/*** Member Methods ***/
/* .... */
void swap(Stack& swapStack);
private:
/*** Members ***/
std::size_t idxTop{0}; // Index after the top element
T data[SIZE]; // Contained data
};
For the ones who would like to try it out with the actual implementation: