From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- src/boost/libs/python/test/select_holder.cpp | 76 ++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/boost/libs/python/test/select_holder.cpp (limited to 'src/boost/libs/python/test/select_holder.cpp') diff --git a/src/boost/libs/python/test/select_holder.cpp b/src/boost/libs/python/test/select_holder.cpp new file mode 100644 index 000000000..8650bd06a --- /dev/null +++ b/src/boost/libs/python/test/select_holder.cpp @@ -0,0 +1,76 @@ +// Copyright David Abrahams 2002. +// 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 +#include +#include +#include +#include +#include +#include +#include + +struct BR {}; + +struct Base {}; +struct Derived : Base {}; + +namespace boost { namespace python +{ + // specialization + template <> + struct has_back_reference
+ : mpl::true_ + { + }; +}} // namespace boost::python + +template +void assert_same(U* = 0, T* = 0) +{ + BOOST_STATIC_ASSERT((boost::python::detail::is_same::value)); + +} + +template +void assert_holder(T* = 0, Held* = 0, Holder* = 0) +{ + using namespace boost::python::detail; + using namespace boost::python::objects; + + typedef typename class_metadata< + T,Held,not_specified,not_specified + >::holder h; + + assert_same( + (h*)0 + ); +} + +int test_main(int, char * []) +{ + using namespace boost::python::detail; + using namespace boost::python::objects; + + assert_holder >(); + + assert_holder >(); + assert_holder >(); + assert_holder >(); + + assert_holder >(); + + assert_holder + ,pointer_holder,Base> >(); + + assert_holder + ,pointer_holder_back_reference,Base> >(); + + assert_holder + ,pointer_holder_back_reference,BR> > (); + + return 0; +} + -- cgit v1.2.3