20
May
Making a copy of constructor arguments in C++
Okay, maybe my C++ is getting rusty, but I’m stammering at coming up with a reasonable solution to this problem: Imagine a class, like this one: class Foo { public: Foo(string &name) : name_(name.c_str()) { } private: char *name_; } As you can see, it takes the guts of the string argument passed to the [...]
Continue Reading →