Skip to content

Commit 63deae3

Browse files
committed
Moved pointee up from detail
[SVN r13810]
1 parent 710374e commit 63deae3

File tree

4 files changed

+47
-8
lines changed

4 files changed

+47
-8
lines changed

include/boost/python/object/pointer_holder.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# include <boost/type.hpp>
1515
# include <boost/mpl/select_type.hpp>
1616
# include <boost/mpl/apply.hpp>
17-
# include <boost/python/detail/pointee.hpp>
17+
# include <boost/python/pointee.hpp>
1818
# include <boost/python/detail/preprocessor.hpp>
1919
# include <boost/preprocessor/enum_params.hpp>
2020

@@ -56,7 +56,7 @@ template <class Pointer, class Value>
5656
struct pointer_holder_back_reference : instance_holder
5757
{
5858
private:
59-
typedef typename python::detail::pointee<Pointer>::type held_type;
59+
typedef typename python::pointee<Pointer>::type held_type;
6060
public:
6161

6262
pointer_holder_back_reference(Pointer);

include/boost/python/object/select_holder.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# include <boost/python/has_back_reference.hpp>
1010
# include <boost/python/detail/not_specified.hpp>
11-
# include <boost/python/detail/pointee.hpp>
11+
# include <boost/python/pointee.hpp>
1212
# include <boost/python/object/value_holder.hpp>
1313
# include <boost/python/object/pointer_holder.hpp>
1414
# include <boost/type.hpp>
@@ -36,7 +36,7 @@ namespace detail
3636
template <class T,class Ptr>
3737
struct select_pointer_holder
3838
{
39-
typedef typename python::detail::pointee<Ptr>::type pointee;
39+
typedef typename python::pointee<Ptr>::type pointee;
4040
BOOST_STATIC_CONSTANT(bool, selector = (!is_same<T,pointee>::value) | has_back_reference<T>::value);
4141

4242
typedef typename mpl::select_type<

include/boost/python/pointee.hpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright David Abrahams 2002. Permission to copy, use,
2+
// modify, sell and distribute this software is granted provided this
3+
// copyright notice appears in all copies. This software is provided
4+
// "as is" without express or implied warranty, and with no claim as
5+
// to its suitability for any purpose.
6+
#ifndef POINTEE_DWA2002323_HPP
7+
# define POINTEE_DWA2002323_HPP
8+
9+
# include <boost/type_traits/object_traits.hpp>
10+
11+
namespace boost { namespace python {
12+
13+
namespace detail
14+
{
15+
template <bool is_ptr = true>
16+
struct pointee_impl
17+
{
18+
template <class T> struct apply : remove_pointer<T> {};
19+
};
20+
21+
template <>
22+
struct pointee_impl<false>
23+
{
24+
template <class T> struct apply
25+
{
26+
typedef typename T::element_type type;
27+
};
28+
};
29+
}
30+
31+
template <class T>
32+
struct pointee
33+
: detail::pointee_impl<is_pointer<T>::value>::template apply<T>
34+
{
35+
};
36+
37+
}} // namespace boost::python::detail
38+
39+
#endif // POINTEE_DWA2002323_HPP

test/pointee.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// copyright notice appears in all copies. This software is provided
44
// "as is" without express or implied warranty, and with no claim as
55
// to its suitability for any purpose.
6-
#include <boost/python/detail/pointee.hpp>
6+
#include <boost/python/pointee.hpp>
77
#include <boost/type_traits/same_traits.hpp>
88
#include <memory>
99
#include <boost/shared_ptr.hpp>
@@ -15,19 +15,19 @@ int main()
1515
{
1616
BOOST_STATIC_ASSERT(
1717
(boost::is_same<
18-
boost::python::detail::pointee<std::auto_ptr<char**> >::type
18+
boost::python::pointee<std::auto_ptr<char**> >::type
1919
, char**
2020
>::value));
2121

2222
BOOST_STATIC_ASSERT(
2323
(boost::is_same<
24-
boost::python::detail::pointee<boost::shared_ptr<A> >::type
24+
boost::python::pointee<boost::shared_ptr<A> >::type
2525
, A>::value));
2626

2727
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
2828
BOOST_STATIC_ASSERT(
2929
(boost::is_same<
30-
boost::python::detail::pointee<char*>::type
30+
boost::python::pointee<char*>::type
3131
, char
3232
>::value));
3333
#endif

0 commit comments

Comments
 (0)