1 | |
2 | // (C) Copyright Edward Diener 2011 |
3 | // Use, modification and distribution are subject to the Boost Software License, |
4 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
5 | // http://www.boost.org/LICENSE_1_0.txt). |
6 | |
7 | #include "test_has_type.hpp" |
8 | #include <boost/mpl/assert.hpp> |
9 | #include <boost/mpl/placeholders.hpp> |
10 | #include <boost/type_traits/is_same.hpp> |
11 | using namespace boost::mpl::placeholders; |
12 | |
13 | int main() |
14 | { |
15 | |
16 | // You can always instantiate without compiler errors |
17 | |
18 | TheInteger<AType::BType,boost::is_same<short,_> > aVar; |
19 | BOOST_TTI_HAS_TYPE_GEN(NoOtherType)<AnotherType,boost::is_same<double,_> > aVar2; |
20 | |
21 | // Compile time asserts |
22 | |
23 | BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(AnIntType)<AType,boost::is_same<int,_> >)); |
24 | BOOST_MPL_ASSERT((NameStruct<AType,boost::is_same<AType::AStructType,_> >)); |
25 | BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(AnIntTypeReference)<AType,boost::is_same<int &,_> >)); |
26 | BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(BType)<AType,boost::is_same<AType::BType,_> >)); |
27 | BOOST_MPL_ASSERT((TheInteger<AType::BType,boost::is_same<int,_> >)); |
28 | BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(CType)<AType::BType,boost::is_same<AType::BType::CType,_> >)); |
29 | BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(AnotherIntegerType)<AType::BType::CType,boost::is_same<int,_> >)); |
30 | BOOST_MPL_ASSERT((SomethingElse<AnotherType,boost::is_same<AType::AnIntType,_> >)); |
31 | |
32 | return 0; |
33 | |
34 | } |
35 | |