mirror of
https://github.com/boostorg/python.git
synced 2026-01-22 17:32:55 +00:00
Moved pointee up from detail
[SVN r13810]
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
# include <boost/type.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/apply.hpp>
|
||||
# include <boost/python/detail/pointee.hpp>
|
||||
# include <boost/python/pointee.hpp>
|
||||
# include <boost/python/detail/preprocessor.hpp>
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
|
||||
@@ -56,7 +56,7 @@ template <class Pointer, class Value>
|
||||
struct pointer_holder_back_reference : instance_holder
|
||||
{
|
||||
private:
|
||||
typedef typename python::detail::pointee<Pointer>::type held_type;
|
||||
typedef typename python::pointee<Pointer>::type held_type;
|
||||
public:
|
||||
|
||||
pointer_holder_back_reference(Pointer);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
# include <boost/python/has_back_reference.hpp>
|
||||
# include <boost/python/detail/not_specified.hpp>
|
||||
# include <boost/python/detail/pointee.hpp>
|
||||
# include <boost/python/pointee.hpp>
|
||||
# include <boost/python/object/value_holder.hpp>
|
||||
# include <boost/python/object/pointer_holder.hpp>
|
||||
# include <boost/type.hpp>
|
||||
@@ -36,7 +36,7 @@ namespace detail
|
||||
template <class T,class Ptr>
|
||||
struct select_pointer_holder
|
||||
{
|
||||
typedef typename python::detail::pointee<Ptr>::type pointee;
|
||||
typedef typename python::pointee<Ptr>::type pointee;
|
||||
BOOST_STATIC_CONSTANT(bool, selector = (!is_same<T,pointee>::value) | has_back_reference<T>::value);
|
||||
|
||||
typedef typename mpl::select_type<
|
||||
|
||||
39
include/boost/python/pointee.hpp
Normal file
39
include/boost/python/pointee.hpp
Normal file
@@ -0,0 +1,39 @@
|
||||
// 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 POINTEE_DWA2002323_HPP
|
||||
# define POINTEE_DWA2002323_HPP
|
||||
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <bool is_ptr = true>
|
||||
struct pointee_impl
|
||||
{
|
||||
template <class T> struct apply : remove_pointer<T> {};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct pointee_impl<false>
|
||||
{
|
||||
template <class T> struct apply
|
||||
{
|
||||
typedef typename T::element_type type;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct pointee
|
||||
: detail::pointee_impl<is_pointer<T>::value>::template apply<T>
|
||||
{
|
||||
};
|
||||
|
||||
}} // namespace boost::python::detail
|
||||
|
||||
#endif // POINTEE_DWA2002323_HPP
|
||||
@@ -3,7 +3,7 @@
|
||||
// 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.
|
||||
#include <boost/python/detail/pointee.hpp>
|
||||
#include <boost/python/pointee.hpp>
|
||||
#include <boost/type_traits/same_traits.hpp>
|
||||
#include <memory>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
@@ -15,19 +15,19 @@ int main()
|
||||
{
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<
|
||||
boost::python::detail::pointee<std::auto_ptr<char**> >::type
|
||||
boost::python::pointee<std::auto_ptr<char**> >::type
|
||||
, char**
|
||||
>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<
|
||||
boost::python::detail::pointee<boost::shared_ptr<A> >::type
|
||||
boost::python::pointee<boost::shared_ptr<A> >::type
|
||||
, A>::value));
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<
|
||||
boost::python::detail::pointee<char*>::type
|
||||
boost::python::pointee<char*>::type
|
||||
, char
|
||||
>::value));
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user