// // CRLib - Simple library for STL replacement in private projects. // Copyright © 2020 YaPB Development Team . // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // #pragma once #include CR_NAMESPACE_BEGIN namespace detail { template struct ClearRef { using Type = T; }; template struct ClearRef { using Type = T; }; template struct ClearRef { using Type = T; }; } template typename detail::ClearRef ::Type constexpr &&move (T &&type) noexcept { return static_cast ::Type &&> (type); } template constexpr T &&forward (typename detail::ClearRef ::Type &type) noexcept { return static_cast (type); } template constexpr T &&forward (typename detail::ClearRef ::Type &&type) noexcept { return static_cast (type); } template inline void swap (T &left, T &right) noexcept { auto temp = cr::move (left); left = cr::move (right); right = cr::move (temp); } template inline void swap (T (&left)[S], T (&right)[S]) noexcept { if (&left == &right) { return; } auto begin = left; auto end = begin + S; for (auto temp = right; begin != end; ++begin, ++temp) { cr::swap (*begin, *temp); } } CR_NAMESPACE_END