fix tuple_element: support SFINAE-friendly

This commit is contained in:
bolero-MURAKAMI 2014-05-29 00:25:37 +09:00
parent f42e92b448
commit c15de6136b
64 changed files with 984 additions and 113 deletions

View file

@ -8,6 +8,7 @@
#ifndef SPROUT_ARRAY_TUPLE_HPP
#define SPROUT_ARRAY_TUPLE_HPP
#include <type_traits>
#include <tuple>
#include <sprout/config.hpp>
#include <sprout/workaround/std/cstddef.hpp>
@ -15,6 +16,8 @@
#include <sprout/utility/move.hpp>
#include <sprout/tuple/tuple/get.hpp>
#include <sprout/type_traits/integral_constant.hpp>
#include <sprout/type_traits/identity.hpp>
#include <sprout/detail/nil_base.hpp>
namespace sprout {
//
@ -56,11 +59,9 @@ namespace std {
// tuple_element
//
template<std::size_t I, typename T, std::size_t N>
struct tuple_element<I, sprout::array<T, N> > {
static_assert(I < N, "tuple_element<>: index out of range");
public:
typedef T type;
};
struct tuple_element<I, sprout::array<T, N> >
: public std::conditional<(I < N), sprout::identity<T>, sprout::detail::nil_base>::type
{};
#if defined(__clang__)
# pragma clang diagnostic pop
#endif