unwrap_wrapper.hpp 884 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright David Abrahams 2004. Distributed under the Boost
  2. // Software License, Version 1.0. (See accompanying
  3. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #ifndef UNWRAP_WRAPPER_DWA2004723_HPP
  5. # define UNWRAP_WRAPPER_DWA2004723_HPP
  6. # include <boost/python/detail/prefix.hpp>
  7. # include <boost/python/detail/is_wrapper.hpp>
  8. # include <boost/mpl/eval_if.hpp>
  9. # include <boost/mpl/identity.hpp>
  10. namespace boost { namespace python { namespace detail {
  11. template <class T>
  12. struct unwrap_wrapper_helper
  13. {
  14. typedef typename T::_wrapper_wrapped_type_ type;
  15. };
  16. template <class T>
  17. struct unwrap_wrapper_
  18. : mpl::eval_if<is_wrapper<T>,unwrap_wrapper_helper<T>,mpl::identity<T> >
  19. {};
  20. template <class T>
  21. typename unwrap_wrapper_<T>::type*
  22. unwrap_wrapper(T*)
  23. {
  24. return 0;
  25. }
  26. }}} // namespace boost::python::detail
  27. #endif // UNWRAP_WRAPPER_DWA2004723_HPP