/* Utilities for OctaSTD. * * This file is part of OctaSTD. See COPYING.md for futher information. */ #ifndef OCTA_UTILITY_H #define OCTA_UTILITY_H #include #include "octa/traits.h" namespace octa { template static inline constexpr typename RemoveReference::type && move(T &&v) noexcept { return static_cast::type &&>(v); } template static inline constexpr T && forward(typename RemoveReference::type &v) noexcept { return static_cast(v); } template static inline constexpr T && forward(typename RemoveReference::type &&v) noexcept { return static_cast(v); } template typename AddRvalueReference::type declval(); template void swap(T &a, T &b) { T c(move(a)); a = move(b); b = move(c); } template void swap(T (&a)[N], T (&b)[N]) { for (size_t i = 0; i < N; ++i) { swap(a[i], b[i]); } } } #endif