]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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) | |
f67539c2 TL |
5 | |
6 | #ifndef BOOST_IMPLICIT_CAST_DWA200356_HPP | |
7 | #define BOOST_IMPLICIT_CAST_DWA200356_HPP | |
7c673cae | 8 | |
1e59de90 TL |
9 | #include <boost/config.hpp> |
10 | #ifdef BOOST_HAS_PRAGMA_ONCE | |
11 | # pragma once | |
12 | #endif | |
13 | ||
7c673cae FG |
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> | |
1e59de90 | 31 | BOOST_CONSTEXPR inline T implicit_cast (typename boost::detail::icast_identity<T>::type x) { |
7c673cae FG |
32 | return x; |
33 | } | |
34 | ||
7c673cae FG |
35 | } // namespace boost |
36 | ||
37 | ||
f67539c2 | 38 | #endif // BOOST_IMPLICIT_CAST_DWA200356_HPP |