pointee.hpp 892 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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/python/detail/type_traits.hpp>
  9. namespace boost { namespace python {
  10. namespace detail
  11. {
  12. template <bool is_ptr = true>
  13. struct pointee_impl
  14. {
  15. template <class T> struct apply : detail::remove_pointer<T> {};
  16. };
  17. template <>
  18. struct pointee_impl<false>
  19. {
  20. template <class T> struct apply
  21. {
  22. typedef typename T::element_type type;
  23. };
  24. };
  25. }
  26. template <class T>
  27. struct pointee
  28. : detail::pointee_impl<
  29. detail::is_pointer<T>::value
  30. >::template apply<T>
  31. {
  32. };
  33. }} // namespace boost::python
  34. #endif // POINTEE_DWA2002323_HPP