diff --git a/octa/format.hh b/octa/format.hh index 411e712..d025d02 100644 --- a/octa/format.hh +++ b/octa/format.hh @@ -397,7 +397,7 @@ protected: char p_buf[32]; }; -/* for cusotm container formatting */ +/* for custom container formatting */ template().to_format(declval(), diff --git a/octa/utility.hh b/octa/utility.hh index 7ded16d..48e9dce 100644 --- a/octa/utility.hh +++ b/octa/utility.hh @@ -49,21 +49,19 @@ template AddRvalueReference declval(); namespace detail { template - struct SwapTest { - template struct Test {}; - template static char test(Test *); - template static int test(...); - static constexpr bool value = (sizeof(test(0)) == sizeof(char)); - }; + auto test_swap(int) -> + decltype(IsVoid().swap(declval()))>()); + template + False test_swap(...); template inline void swap_fb(T &a, T &b, EnableIf< - detail::SwapTest::value, bool + decltype(test_swap(0))::value, bool > = true) { a.swap(b); } template inline void swap_fb(T &a, T &b, EnableIf< - !detail::SwapTest::value, bool + !decltype(test_swap(0))::value, bool > = true) { T c(move(a)); a = move(b);