#include <boost/mpl/int.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/map.hpp>
namespace mpl = boost::mpl;
template<class T>
struct size_traits{
typedef typename boost::mpl::at<
mpl::map<
mpl::pair<mpl::int_<sizeof(bool)>, bool>,
mpl::pair<mpl::int_<sizeof(char)>, char>,
mpl::pair<mpl::int_<sizeof(short)>, short>,
mpl::pair<mpl::int_<sizeof(int)>, int>,
mpl::pair<mpl::int_<sizeof(long)>, long>,
mpl::pair<mpl::int_<sizeof(long long)>, long long>,
mpl::pair<mpl::int_<sizeof(float)>, float>,
mpl::pair<mpl::int_<sizeof(double)>, double>
>,
mpl::int_<sizeof(T)>
>::type type;
};
#include <iostream>
#include <typeinfo>
int main(){
std::cout
<< typeid(size_traits<bool>::type ).name() << "\n"
<< typeid(size_traits<char>::type ).name() << "\n"
<< typeid(size_traits<short>::type ).name() << "\n"
<< typeid(size_traits<int>::type ).name() << "\n"
<< typeid(size_traits<long>::type ).name() << "\n"
<< typeid(size_traits<long long>::type).name() << "\n"
<< typeid(size_traits<float>::type ).name() << "\n"
<< typeid(size_traits<double>::type ).name() << "\n"
<< typeid(size_traits<void*>::type ).name() << "\n";
return 0;
}
I2luY2x1ZGUgPGJvb3N0L21wbC9pbnQuaHBwPgojaW5jbHVkZSA8Ym9vc3QvbXBsL2F0LmhwcD4KI2luY2x1ZGUgPGJvb3N0L21wbC9tYXAuaHBwPgoKbmFtZXNwYWNlIG1wbCA9IGJvb3N0OjptcGw7Cgp0ZW1wbGF0ZTxjbGFzcyBUPgpzdHJ1Y3Qgc2l6ZV90cmFpdHN7CiAgICB0eXBlZGVmIHR5cGVuYW1lIGJvb3N0OjptcGw6OmF0PAogICAgICAgIG1wbDo6bWFwPAogICAgICAgICAgICBtcGw6OnBhaXI8bXBsOjppbnRfPHNpemVvZihib29sKT4sICAgICAgYm9vbD4sCiAgICAgICAgICAgIG1wbDo6cGFpcjxtcGw6OmludF88c2l6ZW9mKGNoYXIpPiwgICAgICBjaGFyPiw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