[Discuss] SemiOT - Question for the C++ gurus
Adam Parkin
pzelnip at gmail.com
Sun Mar 4 11:16:37 PST 2007
Okay I realize this isn't a C++ list, but I know there are a few C++
gurus on the list.
How does one indicate in a constructor a default initialization for a
std::vector object? Like what I want is in my default constructor for
my class (which takes a vector as an argument) to initialize a private
member vector to be empty if one isn't supplied to the constructor. Or
in code:
class SomeClass
{
public:
// what goes in the ????? spot?
SomeClass (std::vector<string> vecIn = ?????) : privVec (vecIn);
private:
std::vector<std::string> privVec;
};
SomeClass Foo (); // Foo.privVec initialized with empty vector
SomeClass Bar (someVector); // Bar.privVec initialized with someVector
I'm just not sure what to put in the ????? spot in the constructor above.
Thanks in advance....
--
--
Adam Parkin
E-mail: pzelnip at gmail.com
Blog: http://www.gamertagblog.com/blog/333
----------------------
A.I. is the science of how to get machines to do the things they do in
the movies.
-- Dr. Astro Teller
More information about the Discuss
mailing list