1 .. Metafunctions/Miscellaneous//sizeof_ |100
16 typedef |unspecified| type;
24 Returns the result of a ``sizeof(X)`` expression wrapped into an
25 |Integral Constant| of the corresponding type, ``std::size_t``.
33 #include <boost/mpl/sizeof.hpp>
45 +---------------+-------------------+-------------------------------------------+
46 | Parameter | Requirement | Description |
47 +===============+===================+===========================================+
48 | ``X`` | Any type | A type to compute the ``sizeof`` for. |
49 +---------------+-------------------+-------------------------------------------+
55 For an arbitrary type ``x``:
60 typedef sizeof_<x>::type n;
67 ``x`` is a complete type.
74 typedef size_t< sizeof(x) > n;
89 struct udt { char a[100]; };
91 BOOST_MPL_ASSERT_RELATION( sizeof_<char>::value, ==, sizeof(char) );
92 BOOST_MPL_ASSERT_RELATION( sizeof_<int>::value, ==, sizeof(int) );
93 BOOST_MPL_ASSERT_RELATION( sizeof_<double>::value, ==, sizeof(double) );
94 BOOST_MPL_ASSERT_RELATION( sizeof_<udt>::value, ==, sizeof(my) );
100 |Metafunctions|, |Integral Constant|, |size_t|
103 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
104 Distributed under the Boost Software License, Version 1.0. (See accompanying
105 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)