Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / tti / test / test_has_mem_fun_cv_compile.cpp
1
2 //  (C) Copyright Edward Diener 2013
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_mem_fun.hpp"
8 #include <boost/mpl/assert.hpp>
9
10 int main()
11   {
12   
13   // You can always instantiate without compiler errors even if the member function does not exist
14   
15   BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(someFunctionMember)<AnotherType,double,boost::mpl::vector<short,short,long,int>,boost::function_types::const_qualified> aVar1;
16   
17   // Use const enclosing type
18   
19   BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AnotherConstFunction)<const AnotherType,int,boost::mpl::vector<AType *, short> >));
20   BOOST_MPL_ASSERT((AskIfConst<const AType,void,boost::mpl::vector<float,double> >));
21   
22   // Use const_qualified
23   
24   BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AConstFunction)<AType,double,boost::mpl::vector<long,char>,boost::function_types::const_qualified>));
25   BOOST_MPL_ASSERT((StillTest<AnotherType,AType,boost::mpl::vector<int>,boost::function_types::const_qualified>));
26   
27   // Use volatile enclosing type
28   
29   BOOST_MPL_ASSERT((AnVol<volatile AnotherType,int,boost::mpl::vector<AType *,short> >));
30   BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AVolatileFunction)<volatile AType,double,boost::mpl::vector<long,char> >));
31   
32   // Use volatile_qualified
33   
34   BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(StillVolatile)<AnotherType,bool,boost::mpl::vector<int>,boost::function_types::volatile_qualified>));
35   BOOST_MPL_ASSERT((Volly<AType,void,boost::mpl::vector<float,double>,boost::function_types::volatile_qualified>));
36   
37   // Use const volatile enclosing type
38   
39   BOOST_MPL_ASSERT((CVAnother<const volatile AnotherType,int,boost::mpl::vector<AType *,short> >));
40   BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(StillCV)<const volatile AnotherType,short,boost::mpl::vector<int> >));
41   
42   // Use cv_qualified
43   
44   BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(ConstVolFunction)<AType,void,boost::mpl::vector<float,double>,boost::function_types::cv_qualified>));
45   BOOST_MPL_ASSERT((CVBoth<AType,double,boost::mpl::vector<long,char>,boost::function_types::cv_qualified>));
46   
47   return 0;
48
49   }