]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/example/inherit_multiply.cpp
2 // Copyright Aleksey Gurtovoy 2002-2004
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // See http://www.boost.org/libs/mpl for documentation.
14 #include <boost/mpl/inherit.hpp>
15 #include <boost/mpl/inherit_linearly.hpp>
16 #include <boost/mpl/list.hpp>
20 namespace mpl
= boost::mpl
;
21 using namespace mpl::placeholders
;
23 template< typename T
>
26 typedef tuple_field type
; // note the typedef
30 template< typename T
>
32 T
& field(tuple_field
<T
>& t
)
37 typedef mpl::inherit_linearly
<
38 mpl::list
<int,char const*,bool>
39 , mpl::inherit
< _1
, tuple_field
<_2
> >
48 field
<char const*>(t
) = "text";
49 field
<bool>(t
) = false;
52 << field
<int>(t
) << '\n'
53 << field
<char const*>(t
) << '\n'
54 << field
<bool>(t
) << '\n'