diff --git a/include/boost/python/object/select_holder.hpp b/include/boost/python/object/select_holder.hpp new file mode 100644 index 00000000..72446358 --- /dev/null +++ b/include/boost/python/object/select_holder.hpp @@ -0,0 +1,73 @@ +// Copyright David Abrahams 2002. Permission to copy, use, +// modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +#ifndef SELECT_HOLDER_DWA2002322_HPP +# define SELECT_HOLDER_DWA2002322_HPP + +# include +# include +# include +# include +# include +# include +# include +# include + +namespace boost { namespace python { namespace objects { + +namespace detail +{ + template + struct select_value_holder + { + BOOST_STATIC_CONSTANT(bool, selector = (!is_same::value) | has_back_reference::value); + + typedef typename mpl::select_type< + selector + , value_holder_back_reference + , value_holder + >::type holder; + + static holder* get() { return 0; } + }; + + template + struct select_pointer_holder + { + typedef typename python::detail::pointee::type pointee; + BOOST_STATIC_CONSTANT(bool, selector = (!is_same::value) | has_back_reference::value); + + typedef typename mpl::select_type< + selector + , pointer_holder_back_reference + , pointer_holder + >::type holder; + + static holder* get() { return 0; } + }; +} + +template +inline detail::select_value_holder select_holder(python::detail::not_specified*, T* = 0, NotSpecified* = 0) +{ + return detail::select_value_holder(); +} + +template +inline detail::select_value_holder select_holder(T*, Held* = 0) +{ + return detail::select_value_holder(); +} + + +template +detail::select_pointer_holder select_holder(void*, Ptr* = 0, T* = 0) +{ + return detail::select_pointer_holder(); +} + +}}} // namespace boost::python::objects + +#endif // SELECT_HOLDER_DWA2002322_HPP