Line data Source code
1 : // Copyright (C) 2024 Ryan Malcolm Underwood. 2 : // 3 : // Use, modification, and distribution is subject to the Boost Software 4 : // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 : // http://www.boost.org/LICENSE_1_0.txt) 6 : // 7 : // See http://www.boost.org/libs/optional for documentation. 8 : // 9 : // You are welcome to contact the author at: 10 : // typenametea@gmail.com 11 : 12 : #ifndef BOOST_OPTIONAL_OPTIONAL_DETAIL_OPTIONAL_UTILITY_RMU_06OCT2024_HPP 13 : #define BOOST_OPTIONAL_OPTIONAL_DETAIL_OPTIONAL_UTILITY_RMU_06OCT2024_HPP 14 : 15 : namespace boost { 16 : namespace optional_detail { 17 : 18 : // Workaround: forward and move aren't constexpr in C++11 19 : template <class T> 20 375884 : inline constexpr T&& forward(typename boost::remove_reference<T>::type& t) noexcept 21 : { 22 375884 : return static_cast<T&&>(t); 23 : } 24 : 25 : template <class T> 26 : inline constexpr T&& forward(typename boost::remove_reference<T>::type&& t) noexcept 27 : { 28 : static_assert(!boost::is_lvalue_reference<T>::value, "Can not forward an rvalue as an lvalue."); 29 : return static_cast<T&&>(t); 30 : } 31 : 32 : template <class T> 33 750715 : inline constexpr typename boost::remove_reference<T>::type&& move(T&& t) noexcept 34 : { 35 750715 : return static_cast<typename boost::remove_reference<T>::type&&>(t); 36 : } 37 : 38 : } // namespace optional_detail 39 : } // namespace boost 40 : 41 : #endif