]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/typeof/test/nested_typedef.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / typeof / test / nested_typedef.cpp
CommitLineData
7c673cae
FG
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)
4
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()
9
10
11void do_int(int) {}
12
13struct {
14 template<typename T>
15 T operator[](const T& n) {return n;}
16} int_p;
17
18
19template<typename T> struct wrap
20{
21 BOOST_TYPEOF_NESTED_TYPEDEF_TPL(nested,int_p[& do_int])
22 typedef typename nested::type type;
23};
24
25BOOST_TYPEOF_REGISTER_TEMPLATE(wrap,1)
26
27template<typename T> struct parser
28{
29 struct __rule {
30 static T & a_placeholder;
31 BOOST_TYPEOF_NESTED_TYPEDEF_TPL(nested,int_p[a_placeholder])
32 typedef typename nested::type type;
33 };
34};
35
36BOOST_STATIC_ASSERT((boost::is_same<wrap<double>::type,void(*)(int)>::value));
37BOOST_STATIC_ASSERT((boost::is_same<parser<wrap<double> >::__rule::type,wrap<double> >::value));