| 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 | |
| 6 | #ifndef BOOST_IMPLICIT_CAST_DWA200356_HPP |
| 7 | #define BOOST_IMPLICIT_CAST_DWA200356_HPP |
| 8 | |
| 9 | #include <boost/config.hpp> |
| 10 | #ifdef BOOST_HAS_PRAGMA_ONCE |
| 11 | # pragma once |
| 12 | #endif |
| 13 | |
| 14 | namespace boost { |
| 15 | |
| 16 | namespace detail { |
| 17 | |
| 18 | template<class T> struct icast_identity |
| 19 | { |
| 20 | typedef T type; |
| 21 | }; |
| 22 | |
| 23 | } // namespace detail |
| 24 | |
| 25 | // implementation originally suggested by C. Green in |
| 26 | // http://lists.boost.org/MailArchives/boost/msg00886.php |
| 27 | |
| 28 | // The use of identity creates a non-deduced form, so that the |
| 29 | // explicit template argument must be supplied |
| 30 | template <typename T> |
| 31 | constexpr T implicit_cast (typename boost::detail::icast_identity<T>::type x) { |
| 32 | return x; |
| 33 | } |
| 34 | |
| 35 | } // namespace boost |
| 36 | |
| 37 | |
| 38 | #endif // BOOST_IMPLICIT_CAST_DWA200356_HPP |
| 39 | |