|
Boost Users : |
Subject: Re: [Boost-users] boost variant compile time visitation: verification
From: Hicham Mouline (hicham_at_[hidden])
Date: 2009-04-21 11:04:08
This sentence from the doc
Notable features of
<http://www.boost.org/doc/libs/1_38_0/doc/html/boost/variant.html>
boost::variant include:
* Full value semantics, including adherence to standard overload
resolution rules for conversion operations.
* Compile-time type-safe value visitation via
<http://www.boost.org/doc/libs/1_38_0/doc/html/boost/apply_visitor.html>
boost::apply_visitor.
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_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Ovanes Markarian
Sent: 21 April 2009 15:25
To: boost-users_at_[hidden]
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
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