remove remains of tuple headers

master
Daniel Kolesa 2017-01-28 19:39:50 +01:00
parent c8c24300ee
commit c751275d83
5 changed files with 18 additions and 51 deletions

View File

@ -11,10 +11,11 @@
#include <ctype.h>
#include <assert.h>
#include <utility>
#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<typename T>
std::true_type tuple_like_test(typename std::tuple_size<T>::type *);
template<typename>
std::false_type tuple_like_test(...);
template<typename T>
constexpr bool is_tuple_like = decltype(tuple_like_test<T>(0))::value;
template<typename R, typename T>
inline Ptrdiff format_ritem(
R &writer, Size &fmtn, bool esc, bool, ConstCharRange fmt,
T const &item, EnableIf<!IsTupleLike<T>, bool> = true
T const &item, EnableIf<!is_tuple_like<T>, bool> = true
) {
return format_impl(writer, fmtn, esc, fmt, item);
}
@ -544,7 +557,7 @@ namespace detail {
template<typename R, typename T>
inline Ptrdiff format_ritem(
R &writer, Size &fmtn, bool esc, bool expandval, ConstCharRange fmt,
T const &item, EnableIf<IsTupleLike<T>, bool> = true
T const &item, EnableIf<is_tuple_like<T>, bool> = true
) {
if (expandval) {
return FmtTupleUnpacker<std::tuple_size<T>::value>::unpack(

View File

@ -11,12 +11,12 @@
#include <new>
#include <functional>
#include <tuple>
#include "ostd/platform.hh"
#include "ostd/memory.hh"
#include "ostd/utility.hh"
#include "ostd/type_traits.hh"
#include <ostd/tuple.hh>
namespace ostd {

View File

@ -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 <tuple>
#include <utility>
namespace ostd {
/* is tuple-like */
template<typename T>
constexpr bool IsTupleLike = false;
template<typename T>
constexpr bool IsTupleLike<const T> = IsTupleLike<T>;
template<typename T>
constexpr bool IsTupleLike<volatile T> = IsTupleLike<T>;
template<typename T>
constexpr bool IsTupleLike<const volatile T> = IsTupleLike<T>;
template<typename ...A>
constexpr bool IsTupleLike<std::tuple<A...>> = true;
template<typename T, typename U>
constexpr bool IsTupleLike<std::pair<T, U>> = true;
} /* namespace ostd */
#endif

View File

@ -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

View File

@ -9,9 +9,9 @@
#include <stddef.h>
#include <utility>
#include <tuple>
#include "ostd/type_traits.hh"
#include "ostd/internal/tuple.hh"
namespace ostd {