]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/typeof/test/nested_typedef.cpp
1 // Copyright (C) 2006 Peder Holt
2 // Use, modification and distribution is subject to the Boost Software
3 // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
5 #include <boost/typeof/typeof.hpp>
6 #include <boost/type_traits/is_same.hpp>
7 #include <boost/static_assert.hpp>
8 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
15 T
operator[](const T
& n
) {return n
;}
19 template<typename T
> struct wrap
21 BOOST_TYPEOF_NESTED_TYPEDEF_TPL(nested
,int_p
[& do_int
])
22 typedef typename
nested::type type
;
25 BOOST_TYPEOF_REGISTER_TEMPLATE(wrap
,1)
27 template<typename T
> struct parser
30 static T
& a_placeholder
;
31 BOOST_TYPEOF_NESTED_TYPEDEF_TPL(nested
,int_p
[a_placeholder
])
32 typedef typename
nested::type type
;
36 BOOST_STATIC_ASSERT((boost::is_same
<wrap
<double>::type
,void(*)(int)>::value
));
37 BOOST_STATIC_ASSERT((boost::is_same
<parser
<wrap
<double> >::__rule::type
,wrap
<double> >::value
));