53 lines
1.0 KiB
C++
53 lines
1.0 KiB
C++
/*
|
|
* Copyright 2015 - 2025 gary@drinkingtea.net
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#if __has_include(<utility>)
|
|
#include <utility>
|
|
#include "typetraits.hpp"
|
|
#else
|
|
#include "typetraits.hpp"
|
|
namespace std {
|
|
|
|
template<typename T>
|
|
constexpr ox::remove_reference_t<T> &&move(T &&t) noexcept {
|
|
return static_cast<ox::remove_reference_t<T>&&>(t);
|
|
}
|
|
|
|
template<typename T>
|
|
constexpr void swap(T &a, T &b) noexcept {
|
|
auto temp = std::move(a);
|
|
a = std::move(b);
|
|
b = std::move(temp);
|
|
}
|
|
|
|
}
|
|
#endif
|
|
|
|
namespace ox {
|
|
|
|
struct in_place_t {
|
|
explicit constexpr in_place_t() = default;
|
|
};
|
|
|
|
inline constexpr ox::in_place_t in_place;
|
|
|
|
template<class T>
|
|
constexpr T &&forward(remove_reference_t<T> &t) noexcept {
|
|
return static_cast<T&&>(t);
|
|
}
|
|
|
|
template<class T>
|
|
constexpr T &&forward(remove_reference_t<T> &&t) noexcept {
|
|
return static_cast<T&&>(t);
|
|
}
|
|
|
|
}
|
|
|