test_has_mem_data_compile.cpp 1.1 KB

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_mem_data.hpp"
  6. #include <boost/mpl/assert.hpp>
  7. int main()
  8. {
  9. // You can always instantiate without compiler errors
  10. BOOST_TTI_HAS_MEMBER_DATA_GEN(aMember)<AType,long> aVar;
  11. BOOST_TTI_HAS_MEMBER_DATA_GEN(someDataMember)<AnotherType,double> aVar2;
  12. // Compile time asserts
  13. BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_DATA_GEN(AnInt)<AType,int>));
  14. BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_DATA_GEN(AnInt)<AnotherType,long>));
  15. BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_DATA_GEN(aMember)<AnotherType,bool>));
  16. BOOST_MPL_ASSERT((CMember<AnotherType,bool>));
  17. BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_DATA_GEN(IntBT)<AType,AType::BType>));
  18. BOOST_MPL_ASSERT((NestedData<AType,AType::BType::CType>));
  19. BOOST_MPL_ASSERT((AOther<AnotherType,AType>));
  20. BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_DATA_GEN(ONestStr)<AnotherType,AType::AStructType>));
  21. return 0;
  22. }