libs/function_types/* - check-in

[SVN r37684]
This commit is contained in:
Tobias Schwinger
2007-05-13 13:12:51 +00:00
parent 8df77f9cd0
commit 7f740b33d1
75 changed files with 9537 additions and 0 deletions

85
test/Attic/Jamfile.v2 Normal file
View File

@@ -0,0 +1,85 @@
# (C) Copyright Tobias Schwinger
#
# Use, modification and distribution are subject to the Boost Software License,
# Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
#-------------------------------------------------------------------------------
import testing ;
{
test-suite function_types :
# Classification
[ compile classification/is_function.cpp ]
[ compile classification/is_function_pointer.cpp ]
[ compile classification/is_function_reference.cpp ]
[ compile classification/is_member_function_pointer.cpp ]
[ compile classification/is_member_object_pointer.cpp ]
[ compile classification/is_callable_builtin.cpp ]
[ compile classification/is_nonmember_callable_builtin.cpp ]
[ compile classification/is_member_pointer.cpp ]
[ compile classification/is_cv_mem_func_ptr.cpp ]
[ compile classification/is_variadic.cpp ]
[ compile classification/is_cv_pointer.cpp ]
# [ compile classification/is_cv_function.cpp ]
# Decomposition
[ compile decomposition/components.cpp ]
[ compile decomposition/result_type.cpp ]
[ compile decomposition/function_arity.cpp ]
[ compile decomposition/parameter_types.cpp ]
[ compile decomposition/components_seq.cpp ]
[ compile decomposition/class_type_transform.cpp ]
[ compile-fail decomposition/result_type_fail.cpp ]
[ compile-fail decomposition/parameter_types_fail.cpp ]
[ compile-fail decomposition/function_arity_fail.cpp ]
# Synthesis
[ compile synthesis/function_type.cpp ]
[ compile synthesis/function_pointer.cpp ]
[ compile synthesis/function_reference.cpp ]
[ compile synthesis/member_function_pointer.cpp ]
[ compile synthesis/member_object_pointer.cpp ]
[ compile synthesis/transformation.cpp ]
[ compile synthesis/mem_func_ptr_cv1.cpp ]
[ compile synthesis/mem_func_ptr_cv2.cpp ]
[ compile synthesis/mem_func_ptr_cv_ptr_to_this.cpp ]
[ compile synthesis/variadic_function_synthesis.cpp ]
# [ compile synthesis/cv_function_synthesis.cpp ]
# Reconfiguration
[ compile reconfiguration/preprocessing_mode.cpp ]
[ compile reconfiguration/partial_arity_preprocessing.cpp ]
[ compile reconfiguration/cc_preprocessing.cpp ]
# Custom calling conventions
[ compile custom_ccs/nonmember_ccs.cpp ]
[ compile custom_ccs/nonmember_ccs_exact.cpp ]
[ compile custom_ccs/member_ccs.cpp ]
[ compile custom_ccs/member_ccs_exact.cpp ]
# Code from the examples
[ compile ../example/interpreter_example.cpp ]
[ compile ../example/result_of_example.cpp ]
[ compile ../example/interface_example.cpp ]
[ compile ../example/fast_mem_fn_example.cpp
# needed for Boost.PP file iteration with some compilers
: <include>../example
]
[ compile ../example/macro_type_args_example.cpp ]
;
}

85
test/Jamfile.v2 Normal file
View File

@@ -0,0 +1,85 @@
# (C) Copyright Tobias Schwinger
#
# Use, modification and distribution are subject to the Boost Software License,
# Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
#-------------------------------------------------------------------------------
import testing ;
{
test-suite function_types :
# Classification
[ compile classification/is_function.cpp ]
[ compile classification/is_function_pointer.cpp ]
[ compile classification/is_function_reference.cpp ]
[ compile classification/is_member_function_pointer.cpp ]
[ compile classification/is_member_object_pointer.cpp ]
[ compile classification/is_callable_builtin.cpp ]
[ compile classification/is_nonmember_callable_builtin.cpp ]
[ compile classification/is_member_pointer.cpp ]
[ compile classification/is_cv_mem_func_ptr.cpp ]
[ compile classification/is_variadic.cpp ]
[ compile classification/is_cv_pointer.cpp ]
# [ compile classification/is_cv_function.cpp ]
# Decomposition
[ compile decomposition/components.cpp ]
[ compile decomposition/result_type.cpp ]
[ compile decomposition/function_arity.cpp ]
[ compile decomposition/parameter_types.cpp ]
[ compile decomposition/components_seq.cpp ]
[ compile decomposition/class_type_transform.cpp ]
[ compile-fail decomposition/result_type_fail.cpp ]
[ compile-fail decomposition/parameter_types_fail.cpp ]
[ compile-fail decomposition/function_arity_fail.cpp ]
# Synthesis
[ compile synthesis/function_type.cpp ]
[ compile synthesis/function_pointer.cpp ]
[ compile synthesis/function_reference.cpp ]
[ compile synthesis/member_function_pointer.cpp ]
[ compile synthesis/member_object_pointer.cpp ]
[ compile synthesis/transformation.cpp ]
[ compile synthesis/mem_func_ptr_cv1.cpp ]
[ compile synthesis/mem_func_ptr_cv2.cpp ]
[ compile synthesis/mem_func_ptr_cv_ptr_to_this.cpp ]
[ compile synthesis/variadic_function_synthesis.cpp ]
# [ compile synthesis/cv_function_synthesis.cpp ]
# Reconfiguration
[ compile reconfiguration/preprocessing_mode.cpp ]
[ compile reconfiguration/partial_arity_preprocessing.cpp ]
[ compile reconfiguration/cc_preprocessing.cpp ]
# Custom calling conventions
[ compile custom_ccs/nonmember_ccs.cpp ]
[ compile custom_ccs/nonmember_ccs_exact.cpp ]
[ compile custom_ccs/member_ccs.cpp ]
[ compile custom_ccs/member_ccs_exact.cpp ]
# Code from the examples
[ compile ../example/interpreter_example.cpp ]
[ compile ../example/result_of_example.cpp ]
[ compile ../example/interface_example.cpp ]
[ compile ../example/fast_mem_fn_example.cpp
# needed for Boost.PP file iteration with some compilers
: <include>../example
]
[ compile ../example/macro_type_args_example.cpp ]
;
}

View File

@@ -0,0 +1,86 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/function_types/is_callable_builtin.hpp>
namespace ft = boost::function_types;
typedef void func();
typedef void (*func_ptr)();
typedef void (&func_ref)();
class C;
typedef void (C::*mem_func_ptr)();
typedef void (C::*c_mem_func_ptr)() const;
typedef void (C::*v_mem_func_ptr)() volatile;
typedef void (C::*cv_mem_func_ptr)() const volatile;
BOOST_MPL_ASSERT((
ft::is_callable_builtin< func >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< func_ref >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< mem_func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< c_mem_func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< v_mem_func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< cv_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< mem_func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< C >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< int >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< int* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< int** >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< int& >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< int[] >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< int[1] >
));

View File

@@ -0,0 +1,142 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/function_types/is_function.hpp>
namespace ft = boost::function_types;
template<typename C, typename T>
void test_non_cv(T C::*)
{
BOOST_MPL_ASSERT((
ft::is_function<T, ft::non_const >
));
BOOST_MPL_ASSERT((
ft::is_function<T, ft::non_volatile >
));
BOOST_MPL_ASSERT((
ft::is_function<T, ft::tag<ft::non_const,ft::non_volatile> >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function<T, ft::const_qualified >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function<T, ft::volatile_qualified >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function<T, ft::tag<ft::const_qualified,ft::volatile_qualified> >
));
}
template<typename C, typename T>
void test_c_non_v(T C::*)
{
BOOST_MPL_ASSERT((
ft::is_function<T, ft::const_qualified >
));
BOOST_MPL_ASSERT((
ft::is_function<T, ft::non_volatile >
));
BOOST_MPL_ASSERT((
ft::is_function<T, ft::tag<ft::const_qualified,ft::non_volatile> >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function<T, ft::non_const >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function<T, ft::volatile_qualified >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function<T, ft::tag<ft::non_const,ft::volatile_qualified> >
));
}
template<typename C, typename T>
void test_v_non_c(T C::*)
{
BOOST_MPL_ASSERT((
ft::is_function<T, ft::non_const >
));
BOOST_MPL_ASSERT((
ft::is_function<T, ft::volatile_qualified >
));
BOOST_MPL_ASSERT((
ft::is_function<T, ft::tag<ft::non_const,ft::volatile_qualified> >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function<T, ft::const_qualified >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function<T, ft::non_volatile >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function<T, ft::tag<ft::const_qualified,ft::non_volatile> >
));
}
template<typename C, typename T>
void test_cv(T C::*)
{
BOOST_MPL_ASSERT((
ft::is_function<T, ft::const_qualified >
));
BOOST_MPL_ASSERT((
ft::is_function<T, ft::volatile_qualified >
));
BOOST_MPL_ASSERT((
ft::is_function<T, ft::tag<ft::const_qualified,ft::volatile_qualified> >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function<T, ft::non_const >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function<T, ft::non_volatile >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function<T, ft::tag<ft::non_const,ft::non_volatile> >
));
}
struct C
{
void non_cv(int) { }
void c_non_v(int) const { }
void v_non_c(int) volatile { }
void cv(int) const volatile { }
};
void instanitate()
{
test_non_cv(& C::non_cv);
test_c_non_v(& C::c_non_v);
test_v_non_c(& C::v_non_c);
test_cv(& C::cv);
}

View File

@@ -0,0 +1,150 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/function_types/is_member_function_pointer.hpp>
namespace ft = boost::function_types;
class C;
typedef void (C::*mem_func_ptr)();
typedef void (C::*c_mem_func_ptr)() const;
typedef void (C::*v_mem_func_ptr)() volatile;
typedef void (C::*cv_mem_func_ptr)() const volatile;
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< mem_func_ptr, ft::non_const >
));
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< mem_func_ptr, ft::non_volatile >
));
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< mem_func_ptr,
ft::tag<ft::non_const, ft::non_volatile> >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< mem_func_ptr, ft::const_qualified >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< mem_func_ptr, ft::volatile_qualified >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< mem_func_ptr,
ft::tag<ft::const_qualified, ft::volatile_qualified> >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< mem_func_ptr,
ft::tag<ft::non_const, ft::volatile_qualified> >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< mem_func_ptr,
ft::tag<ft::const_qualified, ft::non_volatile> >
));
//
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< c_mem_func_ptr, ft::const_qualified >
));
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< c_mem_func_ptr, ft::non_volatile >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< c_mem_func_ptr, ft::non_const >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< c_mem_func_ptr, ft::volatile_qualified >
));
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< c_mem_func_ptr,
ft::tag<ft::const_qualified, ft::non_volatile> >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< c_mem_func_ptr,
ft::tag<ft::non_const, ft::volatile_qualified> >
));
//
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< v_mem_func_ptr, ft::volatile_qualified >
));
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< v_mem_func_ptr, ft::non_const >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< v_mem_func_ptr, ft::non_volatile >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< v_mem_func_ptr, ft::const_qualified >
));
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< v_mem_func_ptr,
ft::tag<ft::non_const, ft::volatile_qualified> >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< v_mem_func_ptr,
ft::tag<ft::const_qualified, ft::non_volatile> >
));
//
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< cv_mem_func_ptr, ft::const_qualified >
));
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< cv_mem_func_ptr, ft::volatile_qualified >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< cv_mem_func_ptr, ft::non_const >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< cv_mem_func_ptr, ft::non_volatile >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< cv_mem_func_ptr,
ft::tag<ft::non_const, ft::non_volatile> >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< cv_mem_func_ptr,
ft::tag<ft::const_qualified, ft::non_volatile> >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< cv_mem_func_ptr,
ft::tag<ft::non_const, ft::volatile_qualified> >
));
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< cv_mem_func_ptr,
ft::tag<ft::const_qualified, ft::volatile_qualified> >
));

View File

@@ -0,0 +1,50 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/function_types/is_function_pointer.hpp>
#include <boost/function_types/is_member_function_pointer.hpp>
namespace ft = boost::function_types;
typedef void(* const func_c_ptr)();
typedef void(* volatile func_v_ptr)();
typedef void(* const volatile func_cv_ptr)();
class C;
typedef void(C::* const mem_func_c_ptr)();
typedef void(C::* volatile mem_func_v_ptr)();
typedef void(C::* const volatile mem_func_cv_ptr)();
// note: the pointer has cv-qualifiers, not the function - non_cv tag must match
BOOST_MPL_ASSERT((
ft::is_function_pointer< func_c_ptr, ft::non_cv >
));
BOOST_MPL_ASSERT((
ft::is_function_pointer< func_v_ptr, ft::non_cv >
));
BOOST_MPL_ASSERT((
ft::is_function_pointer< func_cv_ptr, ft::non_cv >
));
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< mem_func_c_ptr, ft::non_cv >
));
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< mem_func_v_ptr, ft::non_cv >
));
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< mem_func_cv_ptr, ft::non_cv >
));

View File

@@ -0,0 +1,87 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/function_types/is_function.hpp>
namespace ft = boost::function_types;
typedef void func();
typedef void (*func_ptr)();
typedef void (&func_ref)();
class C;
typedef void (C::*mem_func_ptr)();
typedef void (C::*c_mem_func_ptr)() const;
typedef void (C::*v_mem_func_ptr)() volatile;
typedef void (C::*cv_mem_func_ptr)() const volatile;
BOOST_MPL_ASSERT((
ft::is_function< func >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function< func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function< func_ref >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function< mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function< c_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function< v_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function< cv_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function< func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function< mem_func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function< C >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function< int >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function< int* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function< int** >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function< int& >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function< int[] >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function< int[1] >
));

View File

@@ -0,0 +1,87 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/function_types/is_function_pointer.hpp>
namespace ft = boost::function_types;
typedef void func();
typedef void (*func_ptr)();
typedef void (&func_ref)();
class C;
typedef void (C::*mem_func_ptr)();
typedef void (C::*c_mem_func_ptr)() const;
typedef void (C::*v_mem_func_ptr)() volatile;
typedef void (C::*cv_mem_func_ptr)() const volatile;
BOOST_MPL_ASSERT_NOT((
ft::is_function_pointer< func >
));
BOOST_MPL_ASSERT((
ft::is_function_pointer< func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_pointer< func_ref >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_pointer< mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_pointer< c_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_pointer< v_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_pointer< cv_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_pointer< func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_pointer< mem_func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_pointer< C >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_pointer< int >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_pointer< int* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_pointer< int** >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_pointer< int& >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_pointer< int[] >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_pointer< int[1] >
));

View File

@@ -0,0 +1,88 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/function_types/is_function_reference.hpp>
namespace ft = boost::function_types;
typedef void func();
typedef void (*func_ptr)();
typedef void (&func_ref)();
class C;
typedef void (C::*mem_func_ptr)();
typedef void (C::*c_mem_func_ptr)() const;
typedef void (C::*v_mem_func_ptr)() volatile;
typedef void (C::*cv_mem_func_ptr)() const volatile;
BOOST_MPL_ASSERT_NOT((
ft::is_function_reference< func >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_reference< func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_function_reference< func_ref >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_reference< mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_reference< c_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_reference< v_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_reference< cv_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_reference< func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_reference< mem_func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_reference< C >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_reference< int >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_reference< int* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_reference< int** >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_reference< int& >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_reference< int[] >
));
BOOST_MPL_ASSERT_NOT((
ft::is_function_reference< int[1] >
));

View File

@@ -0,0 +1,96 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/function_types/is_member_function_pointer.hpp>
namespace ft = boost::function_types;
typedef void func();
typedef void (*func_ptr)();
typedef void (&func_ref)();
class C;
typedef void (C::*mem_func_ptr)();
typedef void (C::*c_mem_func_ptr)() const;
typedef void (C::*v_mem_func_ptr)() volatile;
typedef void (C::*cv_mem_func_ptr)() const volatile;
typedef int C::*mem_ptr;
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< func >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< func_ref >
));
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< mem_func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< c_mem_func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< v_mem_func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_member_function_pointer< cv_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< mem_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< mem_func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< mem_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< C >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< int >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< int* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< int** >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< int& >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< int[] >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_function_pointer< int[1] >
));

View File

@@ -0,0 +1,95 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/function_types/is_member_object_pointer.hpp>
namespace ft = boost::function_types;
typedef void func();
typedef void (*func_ptr)();
typedef void (&func_ref)();
class C;
typedef void (C::*mem_func_ptr)();
typedef void (C::*c_mem_func_ptr)() const;
typedef void (C::*v_mem_func_ptr)() volatile;
typedef void (C::*cv_mem_func_ptr)() const volatile;
typedef int C::*mem_ptr;
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< func >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< func_ref >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< c_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< v_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< cv_mem_func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_member_object_pointer< mem_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< mem_func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< mem_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< C >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< int >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< int* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< int** >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< int& >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< int[] >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_object_pointer< int[1] >
));

View File

@@ -0,0 +1,88 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/function_types/is_member_pointer.hpp>
namespace ft = boost::function_types;
typedef void func();
typedef void (*func_ptr)();
typedef void (&func_ref)();
class C;
typedef void (C::*mem_func_ptr)();
typedef void (C::*c_mem_func_ptr)() const;
typedef void (C::*v_mem_func_ptr)() volatile;
typedef void (C::*cv_mem_func_ptr)() const volatile;
typedef int C::*mem_ptr;
BOOST_MPL_ASSERT_NOT((
ft::is_member_pointer< func >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_pointer< func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_pointer< func_ref >
));
BOOST_MPL_ASSERT((
ft::is_member_pointer< mem_func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_member_pointer< c_mem_func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_member_pointer< v_mem_func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_member_pointer< cv_mem_func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_member_pointer< mem_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_pointer< func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_pointer< mem_func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_pointer< mem_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_pointer< C >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_pointer< int >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_pointer< int* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_pointer< int** >
));
BOOST_MPL_ASSERT_NOT((
ft::is_member_pointer< int& >
));

View File

@@ -0,0 +1,87 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/function_types/is_nonmember_callable_builtin.hpp>
namespace ft = boost::function_types;
typedef void func();
typedef void (*func_ptr)();
typedef void (&func_ref)();
class C;
typedef void (C::*mem_func_ptr)();
typedef void (C::*c_mem_func_ptr)() const;
typedef void (C::*v_mem_func_ptr)() volatile;
typedef void (C::*cv_mem_func_ptr)() const volatile;
BOOST_MPL_ASSERT((
ft::is_nonmember_callable_builtin< func >
));
BOOST_MPL_ASSERT((
ft::is_nonmember_callable_builtin< func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_nonmember_callable_builtin< func_ref >
));
BOOST_MPL_ASSERT_NOT((
ft::is_nonmember_callable_builtin< mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_nonmember_callable_builtin< c_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_nonmember_callable_builtin< v_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_nonmember_callable_builtin< cv_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_nonmember_callable_builtin< func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_nonmember_callable_builtin< mem_func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_nonmember_callable_builtin< C >
));
BOOST_MPL_ASSERT_NOT((
ft::is_nonmember_callable_builtin< int >
));
BOOST_MPL_ASSERT_NOT((
ft::is_nonmember_callable_builtin< int* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_nonmember_callable_builtin< int** >
));
BOOST_MPL_ASSERT_NOT((
ft::is_nonmember_callable_builtin< int& >
));
BOOST_MPL_ASSERT_NOT((
ft::is_nonmember_callable_builtin< int[] >
));
BOOST_MPL_ASSERT_NOT((
ft::is_nonmember_callable_builtin< int[1] >
));

View File

@@ -0,0 +1,143 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/function_types/is_callable_builtin.hpp>
namespace ft = boost::function_types;
typedef void func(...);
typedef void nv_func();
typedef void (*func_ptr)(...);
typedef void (*nv_func_ptr)();
typedef void (&func_ref)(...);
typedef void (&nv_func_ref)();
class C;
typedef void (C::*mem_func_ptr)(...);
typedef void (C::*nv_mem_func_ptr)();
typedef void (C::*c_mem_func_ptr)(...) const;
typedef void (C::*v_mem_func_ptr)(...) volatile;
typedef void (C::*cv_mem_func_ptr)(...) const volatile;
typedef int C::* mem_ptr;
BOOST_MPL_ASSERT((
ft::is_callable_builtin< func >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< func, ft::variadic >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< func, ft::non_variadic >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< nv_func >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< nv_func, ft::variadic >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< nv_func, ft::non_variadic >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< func_ptr, ft::variadic>
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< func_ptr, ft::non_variadic >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< nv_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< nv_func_ptr, ft::variadic>
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< nv_func_ptr, ft::non_variadic >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< func_ref >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< mem_func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< mem_func_ptr, ft::variadic >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< mem_func_ptr, ft::non_variadic >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< nv_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< nv_mem_func_ptr, ft::variadic >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< nv_mem_func_ptr, ft::non_variadic >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< c_mem_func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< v_mem_func_ptr >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< cv_mem_func_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< mem_func_ptr* >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< C, ft::variadic >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< C, ft::non_variadic >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< mem_ptr >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< mem_ptr, ft::variadic >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< mem_ptr, ft::non_variadic >
));

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/function_types/member_function_pointer.hpp>
#include <boost/function_types/is_callable_builtin.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
typedef ft::stdcall_cc cc;
class C;
BOOST_MPL_ASSERT((
ft::is_callable_builtin<
ft::member_function_pointer<mpl::vector<int, C &>, cc>::type
>
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin<
ft::member_function_pointer<mpl::vector<int, C const &>, cc>::type
>
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin<
ft::member_function_pointer<mpl::vector<int, C volatile &>, cc>::type
>
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin<
ft::member_function_pointer<mpl::vector<int, C const volatile &>, cc>::type
>
));

View File

@@ -0,0 +1,65 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/function_types/member_function_pointer.hpp>
#include <boost/function_types/is_callable_builtin.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
typedef ft::stdcall_cc cc;
typedef ft::default_cc dc;
class C;
BOOST_MPL_ASSERT((
ft::is_callable_builtin< ft::member_function_pointer<mpl::vector<int, C &>, cc>::type, cc >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< ft::member_function_pointer<mpl::vector<int, C const &>, cc>::type, cc >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< ft::member_function_pointer<mpl::vector<int, C volatile &>, cc>::type, cc >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< ft::member_function_pointer<mpl::vector<int, C const volatile &>, cc>::type, cc >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< ft::member_function_pointer<mpl::vector<int, C &> >::type, dc >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< ft::member_function_pointer<mpl::vector<int, C &>, cc>::type, dc >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< ft::member_function_pointer<mpl::vector<int, C const &>, cc>::type, dc >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< ft::member_function_pointer<mpl::vector<int, C volatile &>, cc>::type, dc >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< ft::member_function_pointer<mpl::vector<int, C const volatile &>, cc>::type, dc >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< ft::member_function_pointer<mpl::vector<int, C &> >::type, cc >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< ft::member_function_pointer<mpl::vector<int, C &>, cc>::type, dc >
));

View File

@@ -0,0 +1,39 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/function_types/function_type.hpp>
#include <boost/function_types/function_pointer.hpp>
#include <boost/function_types/function_reference.hpp>
#include <boost/function_types/is_callable_builtin.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
typedef ft::stdcall_cc cc;
BOOST_MPL_ASSERT((
ft::is_callable_builtin<
ft::function_type<mpl::vector<void,int>, cc>::type
>
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin<
ft::function_pointer<mpl::vector<void,int>, cc>::type
>
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin<
ft::function_reference<mpl::vector<void,int>, cc>::type
>
));

View File

@@ -0,0 +1,56 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/function_types/function_type.hpp>
#include <boost/function_types/function_pointer.hpp>
#include <boost/function_types/function_reference.hpp>
#include <boost/function_types/is_callable_builtin.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
typedef ft::stdcall_cc cc;
typedef ft::default_cc dc;
BOOST_MPL_ASSERT((
ft::is_callable_builtin< ft::function_type<mpl::vector<void>,cc>::type, cc >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< ft::function_pointer<mpl::vector<void>,cc>::type, cc >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< ft::function_reference<mpl::vector<void>,cc>::type, cc >
));
BOOST_MPL_ASSERT((
ft::is_callable_builtin< ft::function_pointer<mpl::vector<void> >::type, dc >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< ft::function_type<mpl::vector<void>, cc>::type, dc >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< ft::function_pointer<mpl::vector<void>,cc>::type, dc >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< ft::function_reference<mpl::vector<void>,cc>::type, dc >
));
BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< ft::function_pointer<mpl::vector<void> >::type, cc >
));

View File

@@ -0,0 +1,62 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/add_pointer.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/always.hpp>
#include <boost/function_types/components.hpp>
#include <boost/function_types/parameter_types.hpp>
using namespace boost;
namespace ft = function_types;
using boost::mpl::placeholders::_;
class C;
typedef C (C::*mem_func_ptr)();
class X;
BOOST_MPL_ASSERT((
is_same< mpl::at_c<
ft::components<mem_func_ptr, add_pointer<_> >
,1 >::type, C* >
));
BOOST_MPL_ASSERT((
is_same< mpl::at_c<
ft::components<mem_func_ptr, add_pointer< add_pointer<_> > >
,1 >::type, C** >
));
BOOST_MPL_ASSERT((
is_same< mpl::at_c<
ft::components<mem_func_ptr, mpl::always<X> >
,1 >::type, X >
));
BOOST_MPL_ASSERT((
is_same< mpl::at_c<
ft::parameter_types<mem_func_ptr, add_pointer<_> >
,0 >::type, C* >
));
BOOST_MPL_ASSERT((
is_same< mpl::at_c<
ft::parameter_types<mem_func_ptr, add_pointer< add_pointer<_> > >
,0 >::type, C** >
));
BOOST_MPL_ASSERT((
is_same< mpl::at_c<
ft::parameter_types<mem_func_ptr, mpl::always<X> >
,0 >::type, X >
));

View File

@@ -0,0 +1,59 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/equal.hpp>
#include <boost/function_types/components.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
class C;
typedef C func();
typedef C (*func_ptr)(int);
typedef C (&func_ref)(int,int);
typedef C (C::*mem_func_ptr)();
typedef C (C::*c_mem_func_ptr)(int) const;
typedef C (C::*v_mem_func_ptr)(int,int) volatile;
typedef C (C::*cv_mem_func_ptr)(int,int,int) const volatile;
typedef int C::* mem_ptr;
BOOST_MPL_ASSERT((
mpl::equal< ft::components<func>::types, mpl::vector<C> >
));
BOOST_MPL_ASSERT((
mpl::equal< ft::components<func_ptr>::types, mpl::vector<C,int> >
));
BOOST_MPL_ASSERT((
mpl::equal< ft::components<func_ref>::types, mpl::vector<C,int,int> >
));
BOOST_MPL_ASSERT((
mpl::equal< ft::components<mem_func_ptr>::types, mpl::vector<C,C &> >
));
BOOST_MPL_ASSERT((
mpl::equal< ft::components<c_mem_func_ptr>::types, mpl::vector<C,C const &,int> >
));
BOOST_MPL_ASSERT((
mpl::equal< ft::components<v_mem_func_ptr>::types, mpl::vector<C,C volatile &,int,int> >
));
BOOST_MPL_ASSERT((
mpl::equal< ft::components<cv_mem_func_ptr>::types, mpl::vector<C,C const volatile &,int,int,int> >
));
BOOST_MPL_ASSERT((
mpl::equal< ft::components<mem_ptr>::types, mpl::vector<int &,C&> >
));

View File

@@ -0,0 +1,75 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/equal.hpp>
#include <boost/mpl/front.hpp>
#include <boost/mpl/back.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/begin_end.hpp>
#include <boost/mpl/clear.hpp>
#include <boost/mpl/push_front.hpp>
#include <boost/mpl/pop_front.hpp>
#include <boost/mpl/push_back.hpp>
#include <boost/mpl/pop_back.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/empty.hpp>
#include <boost/function_types/components.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
using boost::is_same;
class C;
typedef C (C::* mem_func_ptr)(int);
typedef ft::components<mem_func_ptr> c;
// front
BOOST_MPL_ASSERT(( is_same< ::boost::mpl::front<c>::type, C > ));
// back
BOOST_MPL_ASSERT(( is_same< ::boost::mpl::back<c>::type, int > ));
// at
BOOST_MPL_ASSERT(( is_same< ::boost::mpl::at_c<c,0>::type, C > ));
BOOST_MPL_ASSERT(( is_same< ::boost::mpl::at_c<c,1>::type, C & > ));
BOOST_MPL_ASSERT(( is_same< ::boost::mpl::at_c<c,2>::type, int > ));
// begin/end
BOOST_MPL_ASSERT(( mpl::equal< c, mpl::vector<C,C &, int> > ));
// clear
BOOST_MPL_ASSERT(( mpl::equal< mpl::clear<c>, mpl::vector<> > ));
// push_front
BOOST_MPL_ASSERT(( mpl::equal< mpl::push_front<c,C>::type, mpl::vector<C,C,C &,int> > ));
// pop_front
BOOST_MPL_ASSERT(( mpl::equal< mpl::pop_front<c>::type, mpl::vector<C &,int> > ));
// push_back
BOOST_MPL_ASSERT(( mpl::equal< mpl::push_back<c,C>::type, mpl::vector<C,C &,int,C> > ));
// pop_back
BOOST_MPL_ASSERT(( mpl::equal< mpl::pop_back<c>::type, mpl::vector<C,C &> > ));
// size
BOOST_MPL_ASSERT_RELATION( ::boost::mpl::size<c>::value, ==, 3 );
// empty
BOOST_MPL_ASSERT_NOT(( mpl::empty<c> ));
BOOST_MPL_ASSERT(( mpl::empty< mpl::clear<c> > ));

View File

@@ -0,0 +1,31 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/function_types/function_arity.hpp>
class C;
typedef C func();
typedef C (*func_ptr)(int);
typedef C (&func_ref)(int,int);
typedef C (C::*mem_func_ptr)();
typedef C (C::*c_mem_func_ptr)(int) const;
typedef C (C::*v_mem_func_ptr)(int,int) volatile;
typedef C (C::*cv_mem_func_ptr)(int,int,int) const volatile;
typedef int C::* mem_ptr;
BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity<func>::value, ==, 0 );
BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity<func_ptr>::value, ==, 1 );
BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity<func_ref>::value, ==, 2 );
BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity<mem_func_ptr>::value, ==, 1 );
BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity<c_mem_func_ptr>::value, ==, 2 );
BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity<v_mem_func_ptr>::value, ==, 3 );
BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity<cv_mem_func_ptr>::value, ==, 4 );
BOOST_MPL_ASSERT_RELATION( ::boost::function_types::function_arity<mem_ptr>::value, ==, 1 );

View File

@@ -0,0 +1,19 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/function_types/function_arity.hpp>
namespace ft = boost::function_types;
class C;
typedef ft::function_arity<C>::type error_1;
typedef ft::function_arity<int>::type error_2;
typedef ft::function_arity<void>::type error_3;

View File

@@ -0,0 +1,56 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/equal.hpp>
#include <boost/function_types/parameter_types.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
class C;
typedef C func(C);
typedef C (*func_ptr)(C,int);
typedef C (&func_ref)();
typedef C (C::*mem_func_ptr)(C,int);
typedef C (C::*c_mem_func_ptr)(C,C) const;
typedef C (C::*v_mem_func_ptr)(C) volatile;
typedef C (C::*cv_mem_func_ptr)() const volatile;
BOOST_MPL_ASSERT((
mpl::equal< ft::parameter_types<func>, mpl::vector<C> >
));
BOOST_MPL_ASSERT((
mpl::equal< ft::parameter_types<func_ptr>::type, mpl::vector<C,int> >
));
BOOST_MPL_ASSERT((
mpl::equal< ft::parameter_types<func_ref>, mpl::vector<> >
));
BOOST_MPL_ASSERT((
mpl::equal< ft::parameter_types<mem_func_ptr>, mpl::vector<C &,C,int> >
));
BOOST_MPL_ASSERT((
mpl::equal< ft::parameter_types<c_mem_func_ptr>, mpl::vector<C const &,C,C> >
));
BOOST_MPL_ASSERT((
mpl::equal< ft::parameter_types<v_mem_func_ptr>, mpl::vector<C volatile &,C> >
));
BOOST_MPL_ASSERT((
mpl::equal< ft::parameter_types<cv_mem_func_ptr>, mpl::vector<C const volatile &> >
));

View File

@@ -0,0 +1,19 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/function_types/parameter_types.hpp>
namespace ft = boost::function_types;
class C;
typedef ft::parameter_types<C>::type error_1;
typedef ft::parameter_types<char>::type error_2;
typedef ft::parameter_types<void>::type error_3;

View File

@@ -0,0 +1,63 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/function_types/result_type.hpp>
namespace ft = boost::function_types;
class C;
typedef C func();
typedef C (*func_ptr)();
typedef C (&func_ref)();
typedef C (C::*mem_func_ptr)();
typedef C (C::*c_mem_func_ptr)() const;
typedef C (C::*v_mem_func_ptr)() volatile;
typedef C (C::*cv_mem_func_ptr)() const volatile;
typedef int C::* mem_ptr;
typedef int const C::* c_mem_ptr;
BOOST_MPL_ASSERT((
boost::is_same<ft::result_type<func>::type,C>
));
BOOST_MPL_ASSERT((
boost::is_same<ft::result_type<func_ptr>::type,C>
));
BOOST_MPL_ASSERT((
boost::is_same<ft::result_type<func_ref>::type,C>
));
BOOST_MPL_ASSERT((
boost::is_same<ft::result_type<mem_func_ptr>::type,C>
));
BOOST_MPL_ASSERT((
boost::is_same<ft::result_type<c_mem_func_ptr>::type,C>
));
BOOST_MPL_ASSERT((
boost::is_same<ft::result_type<v_mem_func_ptr>::type,C>
));
BOOST_MPL_ASSERT((
boost::is_same<ft::result_type<cv_mem_func_ptr>::type,C>
));
BOOST_MPL_ASSERT((
boost::is_same<ft::result_type<mem_ptr>::type,int&>
));
BOOST_MPL_ASSERT((
boost::is_same<ft::result_type<c_mem_ptr>::type,int const&>
));

View File

@@ -0,0 +1,19 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/function_types/result_type.hpp>
namespace ft = boost::function_types;
class C;
typedef ft::result_type<C>::type error_1;
typedef ft::result_type<char>::type error_2;
typedef ft::result_type<void>::type error_3;

View File

@@ -0,0 +1,11 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#define BOOST_FT_CC_PREPROCESSING 1
#include "simple_test.hpp"

View File

@@ -0,0 +1,11 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#define BOOST_FT_MAX_ARITY 19
#include "simple_test.hpp"

View File

@@ -0,0 +1,11 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#define BOOST_FT_PREPROCESSING_MODE 1
#include "simple_test.hpp"

View File

@@ -0,0 +1,51 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/equal.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/function_types/components.hpp>
#include <boost/function_types/function_type.hpp>
#include <boost/function_types/member_function_pointer.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
class C;
typedef void func(C &);
typedef int (C::* mem_func_ptr)(int);
typedef ft::components<func> func_components;
typedef ft::components<mem_func_ptr> mfp_components;
BOOST_MPL_ASSERT((
mpl::equal< func_components::types, mpl::vector<void,C &> >
));
BOOST_MPL_ASSERT_RELATION(
::func_components::function_arity::value, ==, 1
);
BOOST_MPL_ASSERT((
boost::is_same< ft::function_type< mpl::vector<void,C &> >::type, func >
));
BOOST_MPL_ASSERT((
mpl::equal< mfp_components::types, mpl::vector<int,C &,int> >
));
BOOST_MPL_ASSERT_RELATION(
::mfp_components::function_arity::value, ==, 2
);
BOOST_MPL_ASSERT((
boost::is_same< ft::member_function_pointer< mpl::vector<int,C &,int> >::type, mem_func_ptr >
));

View File

@@ -0,0 +1,249 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/function_types/function_type.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
template<typename C, typename T>
void test_non_cv(T C::*)
{
BOOST_MPL_ASSERT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::non_const,ft::non_volatile> >::type
, T
>));
BOOST_MPL_ASSERT(( boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::non_const >::type
, T
>));
BOOST_MPL_ASSERT(( boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::non_volatile >::type
, T
>));
BOOST_MPL_ASSERT(( boost::is_same<
ft::function_type< mpl::vector<void,int> >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::const_qualified,ft::non_volatile> >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::const_qualified >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::non_const,ft::volatile_qualified> >::type
, T
>));
BOOST_MPL_ASSERT_NOT((
boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::volatile_qualified >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::const_qualified,ft::volatile_qualified> >::type
, T
>));
}
template<typename C, typename T>
void test_c_non_v(T C::*)
{
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::non_const,ft::non_volatile> >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::non_const >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::non_volatile >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int> >::type
, T
>));
BOOST_MPL_ASSERT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::const_qualified,ft::non_volatile> >::type
, T
>));
BOOST_MPL_ASSERT(( boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::const_qualified >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::non_const,ft::volatile_qualified> >::type
, T
>));
BOOST_MPL_ASSERT_NOT((
boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::volatile_qualified >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::const_qualified,ft::volatile_qualified> >::type
, T
>));
}
template<typename C, typename T>
void test_v_non_c(T C::*)
{
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::non_const,ft::non_volatile> >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::non_const >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::non_volatile >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int> >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::const_qualified,ft::non_volatile> >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::const_qualified >::type
, T
>));
BOOST_MPL_ASSERT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::non_const,ft::volatile_qualified> >::type
, T
>));
BOOST_MPL_ASSERT((
boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::volatile_qualified >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::const_qualified,ft::volatile_qualified> >::type
, T
>));
}
template<typename C, typename T>
void test_cv(T C::*)
{
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::non_const,ft::non_volatile> >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::non_const >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::non_volatile >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int> >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::const_qualified,ft::non_volatile> >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::const_qualified >::type
, T
>));
BOOST_MPL_ASSERT_NOT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::non_const,ft::volatile_qualified> >::type
, T
>));
BOOST_MPL_ASSERT_NOT((
boost::is_same<
ft::function_type< mpl::vector<void,int>, ft::volatile_qualified >::type
, T
>));
BOOST_MPL_ASSERT(( boost::is_same<
ft::function_type< mpl::vector<void,int>,
ft::tag<ft::const_qualified,ft::volatile_qualified> >::type
, T
>));
}
struct C
{
void non_cv(int) { }
void c_non_v(int) const { }
void v_non_c(int) volatile { }
void cv(int) const volatile { }
};
void instanitate()
{
test_non_cv(& C::non_cv);
test_c_non_v(& C::c_non_v);
test_v_non_c(& C::v_non_c);
test_cv(& C::cv);
}

View File

@@ -0,0 +1,24 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/function_types/function_pointer.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
using boost::is_same;
typedef int (* expected)(int,int);
BOOST_MPL_ASSERT((
is_same< ft::function_pointer< mpl::vector<int,int,int> >::type, expected >
));

View File

@@ -0,0 +1,24 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/function_types/function_reference.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
using boost::is_same;
typedef int (& expected)(int);
BOOST_MPL_ASSERT((
is_same< ft::function_reference< mpl::vector<int,int> >::type, expected >
));

View File

@@ -0,0 +1,23 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/function_types/function_type.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
using boost::is_same;
typedef int expected(int,int);
BOOST_MPL_ASSERT((
is_same< ft::function_type< mpl::vector<int,int,int> >::type, expected >
));

View File

@@ -0,0 +1,94 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/function_types/member_function_pointer.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
using boost::is_same;
class C;
typedef int (C::* expected1)(int);
typedef int (C::* expected2)(int) const;
typedef int (C::* expected3)(int) volatile;
typedef int (C::* expected4)(int) const volatile;
// implicitly specified cv qualification
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C,int> >::type
, expected1 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C const,int> >::type
, expected2 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer<
mpl::vector<int,C volatile,int> >::type
, expected3 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer<
mpl::vector<int,C const volatile,int> >::type
, expected4 >
));
// implicit & explicit/overrides
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer<
mpl::vector<int,C const volatile,int>
, ft::tag<ft::non_const, ft::non_volatile> >::type
, expected1 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C volatile,int>,
ft::tag<ft::const_qualified, ft::non_volatile> >::type
, expected2 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C const,int>,
ft::tag<ft::non_const, ft::volatile_qualified> >::type
, expected3 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C const,int>,
ft::tag<ft::const_qualified, ft::volatile_qualified> >::type
, expected4 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C volatile,int>,
ft::tag<ft::const_qualified, ft::volatile_qualified> >::type
, expected4 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C volatile,int>
, ft::const_qualified >::type
, expected4 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C const,int>
, ft::volatile_qualified >::type
, expected4 >
));

View File

@@ -0,0 +1,94 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/function_types/member_function_pointer.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
using boost::is_same;
class C;
typedef int (C::* expected1)(int);
typedef int (C::* expected2)(int) const;
typedef int (C::* expected3)(int) volatile;
typedef int (C::* expected4)(int) const volatile;
// implicitly specified cv qualification
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C &,int> >::type
, expected1 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C const &,int> >::type
, expected2 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer<
mpl::vector<int,C volatile &,int> >::type
, expected3 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer<
mpl::vector<int,C const volatile &,int> >::type
, expected4 >
));
// implicit & explicit/overrides
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer<
mpl::vector<int,C const volatile &,int>
, ft::tag<ft::non_const, ft::non_volatile> >::type
, expected1 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C volatile &,int>,
ft::tag<ft::const_qualified, ft::non_volatile> >::type
, expected2 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C const &,int>,
ft::tag<ft::non_const, ft::volatile_qualified> >::type
, expected3 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C const &,int>,
ft::tag<ft::const_qualified, ft::volatile_qualified> >::type
, expected4 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C volatile &,int>,
ft::tag<ft::const_qualified, ft::volatile_qualified> >::type
, expected4 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C volatile &,int>
, ft::const_qualified >::type
, expected4 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C const &,int>
, ft::volatile_qualified >::type
, expected4 >
));

View File

@@ -0,0 +1,37 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/function_types/member_function_pointer.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
using boost::is_same;
class C;
typedef int (C::* expected)();
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C * const> >::type
, expected >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C * volatile> >::type
, expected >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C * const volatile> >::type
, expected >
));

View File

@@ -0,0 +1,66 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/function_types/member_function_pointer.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
using boost::is_same;
class C;
typedef int (C::* expected1)(int);
typedef int (C::* expected2)(int) const;
typedef int (C::* expected3)(int) volatile;
typedef int (C::* expected4)(int) const volatile;
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C,int> >::type
, expected1 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C,int>,
ft::tag<ft::non_const, ft::non_volatile> >::type
, expected1 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C,int>
, ft::const_qualified >::type
, expected2 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C,int>,
ft::tag<ft::const_qualified, ft::non_volatile> >::type
, expected2 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C,int>
, ft::volatile_qualified >::type
, expected3 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C,int>,
ft::tag<ft::non_const, ft::volatile_qualified> >::type
, expected3 >
));
BOOST_MPL_ASSERT((
is_same< ft::member_function_pointer< mpl::vector<int,C,int>,
ft::tag<ft::const_qualified, ft::volatile_qualified> >::type
, expected4 >
));

View File

@@ -0,0 +1,27 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/function_types/member_object_pointer.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
using boost::is_same;
class C;
typedef int C::* expected;
BOOST_MPL_ASSERT((
is_same< ft::member_object_pointer< mpl::vector<int,C> >::type
, expected >
));

View File

@@ -0,0 +1,75 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/function_types/function_type.hpp>
#include <boost/function_types/function_pointer.hpp>
#include <boost/function_types/function_reference.hpp>
#include <boost/function_types/member_function_pointer.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
using boost::is_same;
class C;
typedef C func1(C &);
typedef C (*func_ptr1)(C &);
typedef C (&func_ref1)(C &);
typedef C (C::*mem_func_ptr1)();
BOOST_MPL_ASSERT(( is_same< func1, ft::function_type<func1>::type > ));
BOOST_MPL_ASSERT(( is_same< func1, ft::function_type<func_ptr1>::type > ));
BOOST_MPL_ASSERT(( is_same< func1, ft::function_type<func_ref1>::type > ));
BOOST_MPL_ASSERT(( is_same< func1, ft::function_type<mem_func_ptr1>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ptr1, ft::function_pointer<func1>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ptr1, ft::function_pointer<func_ptr1>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ptr1, ft::function_pointer<func_ref1>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ptr1, ft::function_pointer<mem_func_ptr1>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ref1, ft::function_reference<func1>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ref1, ft::function_reference<func_ptr1>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ref1, ft::function_reference<func_ref1>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ref1, ft::function_reference<mem_func_ptr1>::type > ));
BOOST_MPL_ASSERT(( is_same< mem_func_ptr1, ft::member_function_pointer<func1>::type > ));
BOOST_MPL_ASSERT(( is_same< mem_func_ptr1, ft::member_function_pointer<func_ptr1>::type > ));
BOOST_MPL_ASSERT(( is_same< mem_func_ptr1, ft::member_function_pointer<func_ref1>::type > ));
BOOST_MPL_ASSERT(( is_same< mem_func_ptr1, ft::member_function_pointer<mem_func_ptr1>::type > ));
typedef C func2(C const &);
typedef C (*func_ptr2)(C const &);
typedef C (&func_ref2)(C const &);
typedef C (C::*mem_func_ptr2)() const;
BOOST_MPL_ASSERT(( is_same< func2, ft::function_type<func2>::type > ));
BOOST_MPL_ASSERT(( is_same< func2, ft::function_type<func_ptr2>::type > ));
BOOST_MPL_ASSERT(( is_same< func2, ft::function_type<func_ref2>::type > ));
BOOST_MPL_ASSERT(( is_same< func2, ft::function_type<mem_func_ptr2>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ptr2, ft::function_pointer<func2>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ptr2, ft::function_pointer<func_ptr2>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ptr2, ft::function_pointer<func_ref2>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ptr2, ft::function_pointer<mem_func_ptr2>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ref2, ft::function_reference<func2>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ref2, ft::function_reference<func_ptr2>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ref2, ft::function_reference<func_ref2>::type > ));
BOOST_MPL_ASSERT(( is_same< func_ref2, ft::function_reference<mem_func_ptr2>::type > ));
BOOST_MPL_ASSERT(( is_same< mem_func_ptr2, ft::member_function_pointer<func2>::type > ));
BOOST_MPL_ASSERT(( is_same< mem_func_ptr2, ft::member_function_pointer<func_ptr2>::type > ));
BOOST_MPL_ASSERT(( is_same< mem_func_ptr2, ft::member_function_pointer<func_ref2>::type > ));
BOOST_MPL_ASSERT(( is_same< mem_func_ptr2, ft::member_function_pointer<mem_func_ptr2>::type > ));

View File

@@ -0,0 +1,63 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/function_types/function_type.hpp>
#include <boost/function_types/function_pointer.hpp>
#include <boost/function_types/function_reference.hpp>
#include <boost/function_types/member_function_pointer.hpp>
namespace ft = boost::function_types;
namespace mpl = boost::mpl;
using boost::is_same;
class C;
typedef int expected_v_1(...);
typedef int expected_nv_1();
typedef int (C::*expected_v_2)(...);
typedef int (C::*expected_nv_2)();
BOOST_MPL_ASSERT(( is_same<
ft::function_type<mpl::vector<int>, ft::variadic>::type, expected_v_1
> ));
BOOST_MPL_ASSERT(( is_same<
ft::function_type<mpl::vector<int>, ft::non_variadic>::type, expected_nv_1
> ));
BOOST_MPL_ASSERT(( is_same<
ft::function_pointer<mpl::vector<int>, ft::variadic>::type, expected_v_1 *
> ));
BOOST_MPL_ASSERT(( is_same<
ft::function_pointer<mpl::vector<int>, ft::non_variadic>::type
, expected_nv_1 *
> ));
BOOST_MPL_ASSERT(( is_same<
ft::function_reference<mpl::vector<int>, ft::variadic>::type, expected_v_1 &
> ));
BOOST_MPL_ASSERT(( is_same<
ft::function_reference<mpl::vector<int>, ft::non_variadic>::type
, expected_nv_1 &
> ));
BOOST_MPL_ASSERT(( is_same<
ft::member_function_pointer<mpl::vector<int,C>, ft::variadic>::type
, expected_v_2
> ));
BOOST_MPL_ASSERT(( is_same<
ft::member_function_pointer<mpl::vector<int,C>, ft::non_variadic>::type
, expected_nv_2
> ));