// -*-mode:c++;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8-*- // vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :vi #ifndef CTL_UTILITY_H_ #define CTL_UTILITY_H_ #include "remove_reference.h" namespace ctl { namespace __ { template struct no_infer_ { typedef T type; }; template using no_infer = typename no_infer_::type; } // namespace __ template constexpr T&& move(T&& t) noexcept { typedef remove_reference_t U; return static_cast(t); } template constexpr T&& move(T& t) noexcept { return static_cast(t); } template constexpr T&& forward(__::no_infer& t) noexcept { return static_cast(t); } template // TODO(mrdomino): requires move_constructible && move_assignable constexpr void swap(T& a, T& b) noexcept { T t(ctl::move(a)); a = ctl::move(b); b = ctl::move(t); } template // TODO(mrdomino): requires is_swappable constexpr void swap(T (&a)[N], T (&b)[N]) noexcept { for (size_t i = 0; i < N; ++i) swap(a[i], b[i]); } template T&& declval() noexcept; } // namespace ctl #endif // CTL_UTILITY_H_