pointee.hpp 943 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright David Abrahams 2002.
  2. // Distributed under the Boost Software License, Version 1.0. (See
  3. // accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef POINTEE_DWA2002323_HPP
  6. # define POINTEE_DWA2002323_HPP
  7. # include <boost/python/detail/prefix.hpp>
  8. # include <boost/type_traits/object_traits.hpp>
  9. # include <boost/type_traits/remove_pointer.hpp>
  10. namespace boost { namespace python {
  11. namespace detail
  12. {
  13. template <bool is_ptr = true>
  14. struct pointee_impl
  15. {
  16. template <class T> struct apply : remove_pointer<T> {};
  17. };
  18. template <>
  19. struct pointee_impl<false>
  20. {
  21. template <class T> struct apply
  22. {
  23. typedef typename T::element_type type;
  24. };
  25. };
  26. }
  27. template <class T>
  28. struct pointee
  29. : detail::pointee_impl<
  30. ::boost::is_pointer<T>::value
  31. >::template apply<T>
  32. {
  33. };
  34. }} // namespace boost::python::detail
  35. #endif // POINTEE_DWA2002323_HPP