In this stage, you'll create a NamedIntColumn type that has a string
name and col that points to a IntColumn object (from last
stage). You'll practice moving and copying in this project.
Normally, name and col would be private, but you'll make them
public for this project so that the tests can more easily verify
you're doing the correct thing.
You should add this to sparrow.h:
class NamedIntColumn {
public:
std::string name = "";
IntColumn* col = nullptr;
NamedIntColumn(const std::string& name, const std::vector<std::string>& inputs);
NamedIntColumn(const NamedIntColumn& other);
NamedIntColumn(NamedIntColumn&& other);
void operator=(const NamedIntColumn& other);
void operator=(NamedIntColumn&& other);
~NamedIntColumn();
};Then implement those functions in sparrow.cpp.
Assume that there is only ever one pointer from a NamedIntColumn to
an IntColumn -- this means that a NamedIntColumn should delete the
IntColumn (if there is one) upon its own destruction. It also means
that copying a NamedIntColumn must involve copying the IntColumn
as well.
When moving, the target NamedIntColumn should "steal" the pointer
from other.col. Note that std::string also supports moving -- your
move implementations should take advantage of that.