Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:29

0001 /*
0002 Copyright 2021-2023 Glen Joseph Fernandes
0003 (glenjofe@gmail.com)
0004 
0005 Distributed under the Boost Software License, Version 1.0.
0006 (http://www.boost.org/LICENSE_1_0.txt)
0007 */
0008 #ifndef BOOST_CORE_IDENTITY_HPP
0009 #define BOOST_CORE_IDENTITY_HPP
0010 
0011 #include <boost/config.hpp>
0012 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0013 #include <utility>
0014 #endif
0015 
0016 namespace boost {
0017 
0018 struct identity {
0019     typedef void is_transparent;
0020 
0021 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0022     template<class T>
0023     BOOST_CONSTEXPR T&& operator()(T&& value) const BOOST_NOEXCEPT {
0024         return std::forward<T>(value);
0025     }
0026 #else
0027     template<class T>
0028     BOOST_CONSTEXPR const T& operator()(const T& value) const BOOST_NOEXCEPT {
0029         return value;
0030     }
0031 
0032     template<class T>
0033     BOOST_CONSTEXPR T& operator()(T& value) const BOOST_NOEXCEPT {
0034         return value;
0035     }
0036 #endif
0037 
0038     template<class>
0039     struct result { };
0040 
0041     template<class T>
0042     struct result<identity(T&)> {
0043         typedef T& type;
0044     };
0045 
0046 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0047     template<class T>
0048     struct result<identity(T)> {
0049         typedef T&& type;
0050     };
0051 
0052     template<class T>
0053     struct result<identity(T&&)> {
0054         typedef T&& type;
0055     };
0056 #endif
0057 };
0058 
0059 } /* boost */
0060 
0061 #endif