Hi,
Suppose I have this class:
class foo
{
public:
foo() { }
foo(const std::string& s) : _s(s) { }
private:
std::string _s;
};
Which is a member of another class:
class bar
{
public:
bar(bool condition) :
_f(condition ? "go to string constructor" : **go to empty ctor**)
{
}
private:
foo _f;
};
When initializing _f in bar's member initialization list I would like to choose which constructor of foo to invoke based on condition.
What can I put instead of go to empty ctor to make this work? I thought of putting foo(), is there another way?