1// Boost.TypeErasure library
2//
3// Copyright 2011 Steven Watanabe
4//
5// Distributed under the Boost Software License Version 1.0. (See
6// accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9// $Id$
10
11#include <boost/type_erasure/any.hpp>
12#include <boost/type_erasure/builtin.hpp>
13#include <boost/mpl/vector.hpp>
14#include <boost/mpl/assert.hpp>
15#include <boost/type_traits/is_same.hpp>
16
17using namespace boost::type_erasure;
18namespace mpl = boost::mpl;
19
20template<class T = _self>
21struct common : mpl::vector<
22 copy_constructible<T>
23> {};
24
25template<class T = _self>
26struct concept1 : mpl::vector<copy_constructible<T> > {};
27
28template<class T = _self>
29struct concept2 : mpl::vector<concept1<T> > {};
30
31namespace boost {
32namespace type_erasure {
33
34template<class T, class Base>
35struct concept_interface<concept1<T>, Base, T> : Base
36{
37 typedef int id_type;
38};
39
40template<class T, class Base>
41struct concept_interface<concept2<T>, Base, T> : Base
42{
43 typedef char id_type;
44};
45
46}
47}
48
49BOOST_MPL_ASSERT((boost::is_same<any<concept2<> >::id_type, char>));
50BOOST_MPL_ASSERT((boost::is_same<any<mpl::vector<concept2<>, concept1<> > >::id_type, char>));
51BOOST_MPL_ASSERT((boost::is_same<any<mpl::vector<concept1<>, concept2<> > >::id_type, char>));
52

source code of boost/libs/type_erasure/test/test_interface_order.cpp