diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/python/test/indirect_traits_test.cpp | |
parent | Initial commit. (diff) | |
download | ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/python/test/indirect_traits_test.cpp')
-rw-r--r-- | src/boost/libs/python/test/indirect_traits_test.cpp | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/src/boost/libs/python/test/indirect_traits_test.cpp b/src/boost/libs/python/test/indirect_traits_test.cpp new file mode 100644 index 000000000..da4cc2456 --- /dev/null +++ b/src/boost/libs/python/test/indirect_traits_test.cpp @@ -0,0 +1,116 @@ +// Copyright David Abrahams 2004. Distributed under the Boost +// Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +//#include <stdio.h> +#define BOOST_ENABLE_ASSERT_HANDLER +#include <boost/assert.hpp> +#include <boost/mpl/assert.hpp> +#include <boost/python/detail/indirect_traits.hpp> +#include <boost/mpl/assert.hpp> + +//#define print(expr) printf("%s ==> %s\n", #expr, expr) + +// not all the compilers can handle an incomplete class type here. +struct X {}; + +using namespace boost::python::indirect_traits; + +typedef void (X::*pmf)(); + +BOOST_MPL_ASSERT((is_reference_to_function<int (&)()>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_function<int (*)()>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_function<int&>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_function<pmf>)); + +BOOST_MPL_ASSERT_NOT((is_pointer_to_function<int (&)()>)); +BOOST_MPL_ASSERT((is_pointer_to_function<int (*)()>)); +BOOST_MPL_ASSERT_NOT((is_pointer_to_function<int (*&)()>)); +BOOST_MPL_ASSERT_NOT((is_pointer_to_function<int (*const&)()>)); +BOOST_MPL_ASSERT_NOT((is_pointer_to_function<pmf>)); + +BOOST_MPL_ASSERT_NOT((is_reference_to_function_pointer<int (&)()>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_function_pointer<int (*)()>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_function_pointer<int&>)); +BOOST_MPL_ASSERT((is_reference_to_function_pointer<int (*&)()>)); +BOOST_MPL_ASSERT((is_reference_to_function_pointer<int (*const&)()>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_function_pointer<pmf>)); + +BOOST_MPL_ASSERT((is_reference_to_pointer<int*&>)); +BOOST_MPL_ASSERT((is_reference_to_pointer<int* const&>)); +BOOST_MPL_ASSERT((is_reference_to_pointer<int*volatile&>)); +BOOST_MPL_ASSERT((is_reference_to_pointer<int*const volatile&>)); +BOOST_MPL_ASSERT((is_reference_to_pointer<int const*&>)); +BOOST_MPL_ASSERT((is_reference_to_pointer<int const* const&>)); +BOOST_MPL_ASSERT((is_reference_to_pointer<int const*volatile&>)); +BOOST_MPL_ASSERT((is_reference_to_pointer<int const*const volatile&>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_pointer<pmf>)); + +BOOST_MPL_ASSERT_NOT((is_reference_to_pointer<int const volatile>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_pointer<int>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_pointer<int*>)); + +BOOST_MPL_ASSERT_NOT((is_reference_to_const<int*&>)); +BOOST_MPL_ASSERT((is_reference_to_const<int* const&>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_const<int*volatile&>)); +BOOST_MPL_ASSERT((is_reference_to_const<int*const volatile&>)); + +BOOST_MPL_ASSERT_NOT((is_reference_to_const<int const volatile>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_const<int>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_const<int*>)); + +BOOST_MPL_ASSERT((is_reference_to_non_const<int*&>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_non_const<int* const&>)); +BOOST_MPL_ASSERT((is_reference_to_non_const<int*volatile&>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_non_const<int*const volatile&>)); + +BOOST_MPL_ASSERT_NOT((is_reference_to_non_const<int const volatile>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_non_const<int>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_non_const<int*>)); + +BOOST_MPL_ASSERT_NOT((is_reference_to_volatile<int*&>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_volatile<int* const&>)); +BOOST_MPL_ASSERT((is_reference_to_volatile<int*volatile&>)); +BOOST_MPL_ASSERT((is_reference_to_volatile<int*const volatile&>)); + +BOOST_MPL_ASSERT_NOT((is_reference_to_volatile<int const volatile>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_volatile<int>)); +BOOST_MPL_ASSERT_NOT((is_reference_to_volatile<int*>)); + +namespace tt = boost::python::indirect_traits; + +BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class<int>)); +BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class<int&>)); +BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class<int*>)); + + +BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class<pmf>)); +BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class<pmf const&>)); + +BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class<X>)); + +BOOST_MPL_ASSERT((tt::is_reference_to_class<X&>)); +BOOST_MPL_ASSERT((tt::is_reference_to_class<X const&>)); +BOOST_MPL_ASSERT((tt::is_reference_to_class<X volatile&>)); +BOOST_MPL_ASSERT((tt::is_reference_to_class<X const volatile&>)); + +BOOST_MPL_ASSERT_NOT((is_pointer_to_class<int>)); +BOOST_MPL_ASSERT_NOT((is_pointer_to_class<int*>)); +BOOST_MPL_ASSERT_NOT((is_pointer_to_class<int&>)); + +BOOST_MPL_ASSERT_NOT((is_pointer_to_class<X>)); +BOOST_MPL_ASSERT_NOT((is_pointer_to_class<X&>)); +BOOST_MPL_ASSERT_NOT((is_pointer_to_class<pmf>)); +BOOST_MPL_ASSERT_NOT((is_pointer_to_class<pmf const>)); +BOOST_MPL_ASSERT((is_pointer_to_class<X*>)); +BOOST_MPL_ASSERT((is_pointer_to_class<X const*>)); +BOOST_MPL_ASSERT((is_pointer_to_class<X volatile*>)); +BOOST_MPL_ASSERT((is_pointer_to_class<X const volatile*>)); + +BOOST_MPL_ASSERT((tt::is_reference_to_member_function_pointer<pmf&>)); +BOOST_MPL_ASSERT((tt::is_reference_to_member_function_pointer<pmf const&>)); +BOOST_MPL_ASSERT((tt::is_reference_to_member_function_pointer<pmf volatile&>)); +BOOST_MPL_ASSERT((tt::is_reference_to_member_function_pointer<pmf const volatile&>)); +BOOST_MPL_ASSERT_NOT((tt::is_reference_to_member_function_pointer<pmf[2]>)); +BOOST_MPL_ASSERT_NOT((tt::is_reference_to_member_function_pointer<pmf(&)[2]>)); +BOOST_MPL_ASSERT_NOT((tt::is_reference_to_member_function_pointer<pmf>)); + |