test_has_member_cv_compile.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // (C) Copyright Edward Diener 2013
  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) volatile> aVar1;
  11. // Use const
  12. BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AConstFunction)<double (AType::*)(long,char) const>));
  13. BOOST_MPL_ASSERT((StillTest<AType (AnotherType::*)(int) const>));
  14. BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AnotherConstFunction)<int (AnotherType::*)(AType *, short) const>));
  15. BOOST_MPL_ASSERT((AskIfConst<void (AType::*)(float,double) const>));
  16. // Use volatile
  17. BOOST_MPL_ASSERT((AnVol<int (AnotherType::*)(AType *,short) volatile>));
  18. BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AVolatileFunction)<double (AType::*)(long,char) volatile>));
  19. BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(StillVolatile)<bool (AnotherType::*)(int) volatile>));
  20. BOOST_MPL_ASSERT((Volly<void (AType::*)(float,double) volatile>));
  21. // Use const volatile
  22. BOOST_MPL_ASSERT((CVAnother<int (AnotherType::*)(AType *,short) const volatile>));
  23. BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(StillCV)<short (AnotherType::*)(int) const volatile>));
  24. BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(ConstVolFunction)<void (AType::*)(float,double) const volatile>));
  25. BOOST_MPL_ASSERT((CVBoth<double (AType::*)(long,char) const volatile>));
  26. return 0;
  27. }