/* Copyright 2021 Glen Joseph Fernandes (glenjofe@gmail.com) Distributed under the Boost Software License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_FUNCTIONAL_IDENTITY_HPP #define BOOST_FUNCTIONAL_IDENTITY_HPP #include #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #include #endif namespace boost { struct identity { typedef void is_transparent; #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template BOOST_CONSTEXPR T&& operator()(T&& value) const BOOST_NOEXCEPT { return std::forward(value); } #else template BOOST_CONSTEXPR const T& operator()(const T& value) const BOOST_NOEXCEPT { return value; } template BOOST_CONSTEXPR T& operator()(T& value) const BOOST_NOEXCEPT { return value; } #endif template struct result { }; template struct result { typedef T& type; }; #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template struct result { typedef T&& type; }; template struct result { typedef T&& type; }; #endif }; } // boost #endif