I have created the following class:
class CList
{
private:
Cust *custArray{new Cust [1]};
size_t arrayCap{1};
size_t used{0};
// also, the number of used cells
public:
CList() = default;
CList(CList&&);
class Cust
{
private:
const char *name;
const char *email;
size_t id;
public:
Cust()
{
}
Cust(const char *_name, const char *_email, size_t _id)
{
name = _name;
email = _email;
id = _id;
}
};
I need help in implementing CList(CList&&) move constructor. Will it simply create a copy of the object that is passed?
CList(CList&& x) : custArray{std::exchange(x.custArray, nullptr}, arrayCap{std::exchange(x.arrayCap, 0)}, used{std::exchange(x.used, 0)} { }class CList { private: std::vector<Cust> custArray; public: CList() = default; CList(CList&&) = default; };