Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::variant and SFINAE
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2009-12-03 18:02:09


Jonathan Chambers` wrote:
>
> I'm trying to get the program to compile if the variant takes on the
> guise of an int (because I've implemented void operator()(int &i)
> const, but not compile if I make the variant take the guise of a char
> e.g. boost::variant<int, char> var = 'a'; because I've not implemented
> the void operator()(char &c) const

The value (and thus actual type) of a variant is a runtime property;
there cannot be a way to achieve what you want.

Sebastian


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net