implicit_cast.hpp 794 B

123456789101112131415161718192021222324252627282930
  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. # include <boost/mpl/identity.hpp>
  8. namespace boost {
  9. // implementation originally suggested by C. Green in
  10. // http://lists.boost.org/MailArchives/boost/msg00886.php
  11. // The use of identity creates a non-deduced form, so that the
  12. // explicit template argument must be supplied
  13. template <typename T>
  14. inline T implicit_cast (typename mpl::identity<T>::type x) {
  15. return x;
  16. }
  17. // incomplete return type now is here
  18. //template <typename T>
  19. //void implicit_cast (...);
  20. } // namespace boost
  21. #endif // IMPLICIT_CAST_DWA200356_HPP