Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::variant and SFINAE
From: Igor R (boost.lists_at_[hidden])
Date: 2009-12-03 09:31:15

> 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

boost::variant and boost::static_visitor involve *static* (i.e.
compile-time) type checking, so it can't matter what actual type you
feed into the variant in *runtime*.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at