// Copyright Aleksey Gurtovoy 2002-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id$ // $Date$ // $Revision$ #include #include #include #include namespace mpl = boost::mpl; using namespace mpl::placeholders; template< typename T > struct tuple_field { typedef tuple_field type; // note the typedef T field_; }; template< typename T > inline T& field(tuple_field& t) { return t.field_; } typedef mpl::inherit_linearly< mpl::list , mpl::inherit< _1, tuple_field<_2> > >::type my_tuple; int main() { my_tuple t; field(t) = -1; field(t) = "text"; field(t) = false; std::cout << field(t) << '\n' << field(t) << '\n' << field(t) << '\n' ; return 0; }