Files
conversion/include/boost/implicit_cast.hpp

39 lines
892 B
C++
Raw Permalink Normal View History

// Copyright David Abrahams 2003.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
2020-01-25 10:59:32 +03:00
#ifndef BOOST_IMPLICIT_CAST_DWA200356_HPP
#define BOOST_IMPLICIT_CAST_DWA200356_HPP
2003-05-07 22:42:35 +00:00
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
2003-05-07 22:42:35 +00:00
namespace boost {
namespace detail {
template<class T> struct icast_identity
{
2024-12-17 16:37:40 +03:00
using type = T;
};
} // namespace detail
2003-05-07 22:42:35 +00:00
// implementation originally suggested by C. Green in
// http://lists.boost.org/MailArchives/boost/msg00886.php
// The use of identity creates a non-deduced form, so that the
// explicit template argument must be supplied
template <typename T>
2023-08-10 18:52:03 +03:00
constexpr T implicit_cast (typename boost::detail::icast_identity<T>::type x) {
2003-05-07 22:42:35 +00:00
return x;
}
} // namespace boost
2020-01-25 10:59:32 +03:00
#endif // BOOST_IMPLICIT_CAST_DWA200356_HPP