test_has_member_compile.cpp 1.0 KB

12345678910111213141516171819202122232425262728
  1. // (C) Copyright Edward Diener 2011,2012
  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_fun.hpp"
  6. #include <boost/mpl/assert.hpp>
  7. int main()
  8. {
  9. // You can always instantiate without compiler errors
  10. BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(someFunctionMember)<double (AnotherType::*)(short,short,long,int)> aVar3;
  11. // Compile time asserts
  12. BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(VoidFunction)<void (AType::*)()>));
  13. BOOST_MPL_ASSERT((FunctionReturningInt<int (AType::*)()>));
  14. BOOST_MPL_ASSERT((FunctionReturningInt<double (AnotherType::*)(int)>));
  15. BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(aFunction)<AType (AnotherType::*)(int)>));
  16. BOOST_MPL_ASSERT((AnotherIntFunction<int (AnotherType::*)(AType)>));
  17. BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(sFunction)<AType::AnIntType (AnotherType::*)(int,long,double)>));
  18. return 0;
  19. }