From e406301051efd07855c15772feffc0dba2749a82 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 29 Sep 2020 16:39:11 +0200 Subject: [PATCH] move std::move from C++11 to C++14 section In C++14, std::move was changed to be constexpr. Since the version declared by ArxTypeTraits is (now) also constexpr, it should be declared in the C++14 section. This means if the standard library supports only C++11, the C++14 constexpr version is still available (must be referenced as arx::arx_std::move in this case, since we can't replace `std::move`). In practice, newer gcc versions actually expose the `constexpr` versions even when C++14 is not enabled, so it does not really matter there, but this could help in older versions that do not support C++14 at all yet. --- ArxTypeTraits/type_traits.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ArxTypeTraits/type_traits.h b/ArxTypeTraits/type_traits.h index 4bdb24e..840aff9 100644 --- a/ArxTypeTraits/type_traits.h +++ b/ArxTypeTraits/type_traits.h @@ -145,13 +145,6 @@ namespace arx { namespace arx_std { template struct remove_extent { typedef T type; }; - template - constexpr typename remove_reference::type&& move(T&& t) noexcept - { - return static_cast::type&&>(t); - } - - template constexpr T&& forward(typename remove_reference::type& t) noexcept { @@ -451,6 +444,11 @@ namespace arx { namespace arx_std { template using index_sequence_for = make_index_sequence; + template + constexpr typename remove_reference::type&& move(T&& t) noexcept + { + return static_cast::type&&>(t); + } } } // namespace arx::arx_std #endif // Do not have libstdc++14