Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:38:14

0001 /*=============================================================================
0002     Copyright (c) 2014 Paul Fultz II
0003     forward.h
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 
0008 #ifndef BOOST_HOF_GUARD_FORWARD_H
0009 #define BOOST_HOF_GUARD_FORWARD_H
0010 
0011 #include <utility>
0012 
0013 namespace boost { namespace hof {
0014 
0015 // contexpr-friendly forwarding
0016 
0017 template<typename T>
0018 constexpr T&& forward(typename std::remove_reference<T>::type& t) noexcept
0019 { return static_cast<T&&>(t); }
0020 
0021 
0022 template<typename T>
0023 constexpr T&& forward(typename std::remove_reference<T>::type&& t) noexcept
0024 {
0025   static_assert(!std::is_lvalue_reference<T>::value, "T must not be an lvalue reference type");
0026   return static_cast<T&&>(t);
0027 }
0028 
0029 #if (defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7) || defined(_MSC_VER)
0030 #define BOOST_HOF_FORWARD(...) boost::hof::forward<__VA_ARGS__>
0031 #else
0032 #define BOOST_HOF_FORWARD(...) static_cast<__VA_ARGS__ &&>
0033 #endif
0034 
0035 }} // namespace boost::hof
0036 
0037 #endif