I have this:
struct myClass{
multiset<string,binPred<string> > values ;
myClass(const char param1, const char param2) : values(less<string>())
{ }
} ;
I need to initialize the values
member with a different functor depending on the values of param1
and param2
. Unfortunately, the logic to decide which functor to use is not so simple and once values
is constructed I cant change its associated comparison functor.
So... I would need to put all that decision logic in the member initializaion part, but I dont know how aside using the ?:
operator.
Is it possible to put more complex statements in there?? (like switch
staments)
If not, is there a way to delay the construction of values
so I can initialize it in the constructor's body??
Thanks.