在vs2008环境,boost库(忘了什么版本了)
#include <boost/typeof/typeof.hpp>
using namespace std;
int test()
{
static int a = 0;
++ a;
return a;
}
int main()
{
BOOST_AUTO(b, test());
int a = 0;
++ a;
//test();
}
宏展开是boost::type_of::msvc_typeid_wrapper<sizeof(*boost::type_of::encode_start(test()))>::type b = test();
编译结果只有两句话
0041140E call test (41107Dh)
00411413 mov dword ptr [b],eax
跟 int b = test();是一样的。
那么,boost::type_of::msvc_typeid_wrapper<sizeof(*boost::type_of::encode_start(test()))>::type是怎么变成int的呢