variant cast operators?
Hi, I am playing with boost::variant to introduce a more elegant property system into my current project. I was wondering why there are no cast operatorst defined for the variant types, to avoid having to type get<>: boost::variant<double,int,string> v; string s = v; is there a basic reason why this is not possible? Best Daniel
On Mon, 17 Mar 2008 20:05:58 -0000, Daniel Oberhoff <daniel@danieloberhoff.de> wrote:
Hi,
I am playing with boost::variant to introduce a more elegant property system into my current project. I was wondering why there are no cast operatorst defined for the variant types, to avoid having to type get<>:
boost::variant<double,int,string> v; string s = v;
is there a basic reason why this is not possible?
I guess it's because it's pretty dangerous to do implicit casts that may fail. Regards Jiri Palecek
participants (2)
-
Daniel Oberhoff
-
Jiri Palecek