|
Boost Users : |
Subject: Re: [Boost-users] boost variant compile time visitation: verification
From: Igor R (boost.lists_at_[hidden])
Date: 2009-04-21 10:41:47
> If I understood the doc correctly, the visitation is supposed to be compile-time, that is, v.apply_visitor( print_type() ) is already "char" before the program start... Is this right?
The visitation is "compile-time" in the sense that it's type-safe.
"v.apply_visitor( print_type() )" might or might not be substituted by
"char" depending on your optimization switches. In MSVC9, with
optimization (/O2) it produces the following output:
00402B3C push offset string "char" (419368h)
00402B41 push offset std::cout (420BC8h)
00402B46 call std::operator<<<std::char_traits<char> > (4027F0h)
So "v.apply_visitor( print_type() )" is really substituted by "char"
in compile-time.
But without the optimization you'll go through all the visitation calls.
> If so, is there a way to see this in the binary executable file? Maybe
viewing symbols?
In MSVC - compile the program, step into main (or set breakpoint),
then go to Debug-->Windows-->Dissasembly.
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