I wish to have a type that acts similarily to boost::any
but with a more limited type set. Something like this:
limited_any<int,long,string> x; // x is like boost::any but is guaranteed to contain only an int, a long, or a string
How would you recommend implementing this? (Either on my own or using existing solutions)
You are looking for boost::variant.