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/detail/lightweight_test.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 | BOOST_TEST((BOOST_TTI_HAS_TYPE_GEN(AnIntType)<AType,boost::is_same<int,_> >::value)); |
17 | BOOST_TEST((NameStruct<AType,boost::is_same<AType::AStructType,_> >::value)); |
18 | BOOST_TEST((BOOST_TTI_HAS_TYPE_GEN(AnIntTypeReference)<AType,boost::is_same<int &,_> >::value)); |
19 | BOOST_TEST((BOOST_TTI_HAS_TYPE_GEN(BType)<AType,boost::is_same<AType::BType,_> >::value)); |
20 | BOOST_TEST((TheInteger<AType::BType,boost::is_same<int,_> >::value)); |
21 | BOOST_TEST((BOOST_TTI_HAS_TYPE_GEN(CType)<AType::BType,boost::is_same<AType::BType::CType,_> >::value)); |
22 | BOOST_TEST((BOOST_TTI_HAS_TYPE_GEN(AnotherIntegerType)<AType::BType::CType,boost::is_same<int,_> >::value)); |
23 | BOOST_TEST((SomethingElse<AnotherType,boost::is_same<AType::AnIntType,_> >::value)); |
24 | BOOST_TEST((!BOOST_TTI_HAS_TYPE_GEN(NoOtherType)<AnotherType,boost::is_same<double,_> >::value)); |
25 | |
26 | // Passing non-class enclosing type will return false |
27 | |
28 | BOOST_TEST((!BOOST_TTI_HAS_TYPE_GEN(AnIntTypeReference)<AType **,boost::is_same<int &,_> >::value)); |
29 | BOOST_TEST((!SomethingElse<float,boost::is_same<AType::AnIntType,_> >::value)); |
30 | |
31 | return boost::report_errors(); |
32 | |
33 | } |
34 | |