This sentence from the doc

 

Notable features of boost::variant include:

is confusing to me.

 

I was gonna ask if there was a purely compile-time visitor, but that doesn’t make sense,

as the instance of the variant can be assigned any of the bounded types at runtime.

 

Regards,

 

 

 

 

From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Ovanes Markarian
Sent: 21 April 2009 15:25
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] boost variant compile time visitation: verification

 

Hicham,

visitation is not done at compile-time. Doc states as far as I remember that the compiler might (with high probability) inline the calls, so that they have similar performance as a switch statement. Switch usually equals to a jump in assembler. But there must be runtime overhead, since you put at runtime object instances into the variant.


Greetings,
Ovanes