implicit_cast.hpp 883 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright David Abrahams 2003.
  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 IMPLICIT_CAST_DWA200356_HPP
  6. # define IMPLICIT_CAST_DWA200356_HPP
  7. namespace boost {
  8. namespace detail {
  9. template<class T> struct icast_identity
  10. {
  11. typedef T type;
  12. };
  13. } // namespace detail
  14. // implementation originally suggested by C. Green in
  15. // http://lists.boost.org/MailArchives/boost/msg00886.php
  16. // The use of identity creates a non-deduced form, so that the
  17. // explicit template argument must be supplied
  18. template <typename T>
  19. inline T implicit_cast (typename boost::detail::icast_identity<T>::type x) {
  20. return x;
  21. }
  22. // incomplete return type now is here
  23. //template <typename T>
  24. //void implicit_cast (...);
  25. } // namespace boost
  26. #endif // IMPLICIT_CAST_DWA200356_HPP