diff --git a/ostd/format.hh b/ostd/format.hh index c92e3c3..486e9d5 100644 --- a/ostd/format.hh +++ b/ostd/format.hh @@ -11,10 +11,11 @@ #include #include +#include + #include "ostd/algorithm.hh" #include "ostd/string.hh" #include "ostd/utility.hh" -#include "ostd/internal/tuple.hh" namespace ostd { @@ -533,10 +534,22 @@ namespace detail { } }; + /* ugly ass check for whether a type is tuple-like, like tuple itself, + * pair, array, possibly other types added later or overridden... + */ + template + std::true_type tuple_like_test(typename std::tuple_size::type *); + + template + std::false_type tuple_like_test(...); + + template + constexpr bool is_tuple_like = decltype(tuple_like_test(0))::value; + template inline Ptrdiff format_ritem( R &writer, Size &fmtn, bool esc, bool, ConstCharRange fmt, - T const &item, EnableIf, bool> = true + T const &item, EnableIf, bool> = true ) { return format_impl(writer, fmtn, esc, fmt, item); } @@ -544,7 +557,7 @@ namespace detail { template inline Ptrdiff format_ritem( R &writer, Size &fmtn, bool esc, bool expandval, ConstCharRange fmt, - T const &item, EnableIf, bool> = true + T const &item, EnableIf, bool> = true ) { if (expandval) { return FmtTupleUnpacker::value>::unpack( diff --git a/ostd/functional.hh b/ostd/functional.hh index 99ceb49..f6ed9bd 100644 --- a/ostd/functional.hh +++ b/ostd/functional.hh @@ -11,12 +11,12 @@ #include #include +#include #include "ostd/platform.hh" #include "ostd/memory.hh" #include "ostd/utility.hh" #include "ostd/type_traits.hh" -#include namespace ostd { diff --git a/ostd/internal/tuple.hh b/ostd/internal/tuple.hh deleted file mode 100644 index 9376500..0000000 --- a/ostd/internal/tuple.hh +++ /dev/null @@ -1,35 +0,0 @@ -/* Some tuple internals for inclusion from various headers. Partially - * taken from the libc++ project. - * - * This file is part of OctaSTD. See COPYING.md for futher information. - */ - -#ifndef OSTD_INTERNAL_TUPLE_HH -#define OSTD_INTERNAL_TUPLE_HH - -#include -#include - -namespace ostd { - -/* is tuple-like */ - -template -constexpr bool IsTupleLike = false; - -template -constexpr bool IsTupleLike = IsTupleLike; -template -constexpr bool IsTupleLike = IsTupleLike; -template -constexpr bool IsTupleLike = IsTupleLike; - -template -constexpr bool IsTupleLike> = true; - -template -constexpr bool IsTupleLike> = true; - -} /* namespace ostd */ - -#endif diff --git a/ostd/tuple.hh b/ostd/tuple.hh deleted file mode 100644 index 554c973..0000000 --- a/ostd/tuple.hh +++ /dev/null @@ -1,11 +0,0 @@ -/* Tuples or OctaSTD. Partially taken from the libc++ project. - * - * This file is part of OctaSTD. See COPYING.md for futher information. - */ - -#ifndef OSTD_TUPLE_HH -#define OSTD_TUPLE_HH - -#include "ostd/internal/tuple.hh" - -#endif diff --git a/ostd/utility.hh b/ostd/utility.hh index c7234ee..d8277b5 100644 --- a/ostd/utility.hh +++ b/ostd/utility.hh @@ -9,9 +9,9 @@ #include #include +#include #include "ostd/type_traits.hh" -#include "ostd/internal/tuple.hh" namespace ostd {