copy_non_const_reference.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 COPY_NON_CONST_REFERENCE_DWA2002131_HPP
  6. # define COPY_NON_CONST_REFERENCE_DWA2002131_HPP
  7. # include <boost/python/detail/prefix.hpp>
  8. # include <boost/python/detail/indirect_traits.hpp>
  9. # include <boost/mpl/if.hpp>
  10. # include <boost/python/to_python_value.hpp>
  11. namespace boost { namespace python {
  12. namespace detail
  13. {
  14. template <class R>
  15. struct copy_non_const_reference_expects_a_non_const_reference_return_type
  16. # if defined(__GNUC__) || defined(__EDG__)
  17. {}
  18. # endif
  19. ;
  20. }
  21. template <class T> struct to_python_value;
  22. struct copy_non_const_reference
  23. {
  24. template <class T>
  25. struct apply
  26. {
  27. typedef typename mpl::if_c<
  28. indirect_traits::is_reference_to_non_const<T>::value
  29. , to_python_value<T>
  30. , detail::copy_non_const_reference_expects_a_non_const_reference_return_type<T>
  31. >::type type;
  32. };
  33. };
  34. }} // namespace boost::python
  35. #endif // COPY_NON_CONST_REFERENCE_DWA2002131_HPP