test_has_type_compile.cpp 1020 B

12345678910111213141516171819202122232425262728293031
  1. // (C) Copyright Edward Diener 2011
  2. // Use, modification and distribution are subject to the Boost Software License,
  3. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt).
  5. #include "test_has_type.hpp"
  6. #include <boost/mpl/assert.hpp>
  7. int main()
  8. {
  9. // You can always instantiate without compiler errors
  10. BOOST_TTI_HAS_TYPE_GEN(AnIntType)<AnotherType> aVar1;
  11. BOOST_TTI_HAS_TYPE_GEN(NoOtherType)<AType> aVar2;
  12. // Compile time asserts
  13. BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(AnIntType)<AType>));
  14. BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(AnIntTypeReference)<AType>));
  15. BOOST_MPL_ASSERT((NameStruct<AType>));
  16. BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(BType)<AType>));
  17. BOOST_MPL_ASSERT((TheInteger<AType::BType>));
  18. BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(CType)<AType::BType>));
  19. BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(AnotherIntegerType)<AType::BType::CType>));
  20. BOOST_MPL_ASSERT((SomethingElse<AnotherType>));
  21. return 0;
  22. }