/* 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/type_traits.h" namespace octa { template static inline constexpr RemoveReference && move(T &&v) noexcept { return static_cast &&>(v); } template static inline constexpr T && forward(RemoveReference &v) noexcept { return static_cast(v); } template static inline constexpr T && forward(RemoveReference &&v) noexcept { return static_cast(v); } template AddRvalueReference 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