1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

fix index_tuple for ICC: template argument deduntion with aliases

This commit is contained in:
bolero-MURAKAMI 2014-02-22 00:24:38 +09:00
parent eae1729128
commit 7831105add
13 changed files with 46 additions and 37 deletions

View file

@ -86,6 +86,15 @@
# define SPROUT_DEPRECATED
#endif
//
// SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES
//
#if defined(SPROUT_NO_CXX11_TEMPLATE_ALIASES)
# define SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES
#elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
# define SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES
#endif
//
// SPROUT_USE_EXPLICIT_CONVERSION_OPERATORS
// SPROUT_EXPLICIT_CONVERSION

View file

@ -18,13 +18,13 @@ namespace sprout {
// index_n
// uindex_n
//
#if SPROUT_USE_TEMPLATE_ALIASES
#if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<sprout::index_t I, std::size_t N>
using index_n = sprout::integer_n<sprout::index_t, I, N>;
template<sprout::uindex_t I, std::size_t N>
using uindex_n = sprout::integer_n<sprout::uindex_t, I, N>;
#else // #if SPROUT_USE_TEMPLATE_ALIASES
#else // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<sprout::index_t I, std::size_t N>
struct index_n
: public sprout::integer_n<sprout::index_t, I, N>::type
@ -36,7 +36,7 @@ namespace sprout {
: public sprout::integer_n<sprout::uindex_t, I, N>::type
::template transfer<sprout::uindex_tuple<> >
{};
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
#endif // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_INDEX_N_HPP

View file

@ -18,13 +18,13 @@ namespace sprout {
// index_pack
// uindex_pack
//
#if SPROUT_USE_TEMPLATE_ALIASES
#if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<typename... Ts>
using index_pack = sprout::integer_pack<sprout::index_t, Ts...>;
template<typename... Ts>
using uindex_pack = sprout::integer_pack<sprout::uindex_t, Ts...>;
#else // #if SPROUT_USE_TEMPLATE_ALIASES
#else // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<typename... Ts>
struct index_pack
: public sprout::enable_make_indexes<
@ -40,7 +40,7 @@ namespace sprout {
::template transfer<sprout::uindex_tuple<> >
>
{};
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
#endif // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_INDEX_PACK_HPP

View file

@ -17,7 +17,7 @@ namespace sprout {
// index_range
// uindex_range
//
#if SPROUT_USE_TEMPLATE_ALIASES
#if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<
sprout::index_t First, sprout::index_t Last,
typename std::make_signed<sprout::index_t>::type Step = sprout::detail::integer_range_default_step<sprout::index_t, First, Last>::value
@ -29,7 +29,7 @@ namespace sprout {
typename std::make_signed<sprout::uindex_t>::type Step = sprout::detail::integer_range_default_step<sprout::uindex_t, First, Last>::value
>
using uindex_range = sprout::integer_range<sprout::uindex_t, First, Last, Step>;
#else // #if SPROUT_USE_TEMPLATE_ALIASES
#else // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<
sprout::index_t First, sprout::index_t Last,
typename std::make_signed<sprout::index_t>::type Step = sprout::detail::integer_range_default_step<sprout::index_t, First, Last>::value
@ -47,7 +47,7 @@ namespace sprout {
: public sprout::integer_range<sprout::uindex_t, First, Last, Step>::type
::template transfer<sprout::uindex_tuple<> >
{};
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
#endif // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_INDEX_RANGE_HPP

View file

@ -15,15 +15,15 @@ namespace sprout {
//
// index_sequence_for
//
#if SPROUT_USE_TEMPLATE_ALIASES
#if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<typename... Ts>
using index_sequence_for = sprout::uindex_pack<Ts...>;
#else // #if SPROUT_USE_TEMPLATE_ALIASES
#else // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<typename... Ts>
struct index_sequence_for
: public sprout::uindex_pack<Ts...>
{};
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
#endif // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_INDEX_SEQUENCE_FOR_HPP

View file

@ -17,13 +17,13 @@ namespace sprout {
// index_tuple
// uindex_tuple
//
#if SPROUT_USE_TEMPLATE_ALIASES
#if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<sprout::index_t... Indexes>
using index_tuple = sprout::integer_sequence<sprout::index_t, Indexes...>;
template<sprout::uindex_t... Indexes>
using uindex_tuple = sprout::integer_sequence<sprout::uindex_t, Indexes...>;
#else // #if SPROUT_USE_TEMPLATE_ALIASES
#else // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<sprout::index_t... Indexes>
struct index_tuple
: public sprout::integer_sequence<sprout::index_t, Indexes...>
@ -55,7 +55,7 @@ namespace sprout {
return type();
}
};
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
#endif // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_INDEX_TUPLE_HPP

View file

@ -79,15 +79,15 @@ namespace sprout {
//
// integer_range
//
#if SPROUT_USE_TEMPLATE_ALIASES
#if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<typename T, T I, std::size_t N>
using integer_n = typename sprout::detail::integer_n<T, I, N>::type;
#else // #if SPROUT_USE_TEMPLATE_ALIASES
#else // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<typename T, T I, std::size_t N>
struct integer_n
: public sprout::detail::integer_n<T, I, N>
{};
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
#endif // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_INTEGER_N_HPP

View file

@ -16,15 +16,15 @@ namespace sprout {
//
// integer_pack
//
#if SPROUT_USE_TEMPLATE_ALIASES
#if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<typename T, typename... Ts>
using integer_pack = sprout::make_integer_sequence<T, sprout::detail::sizeof_pack<Ts...>::value>;
#else // #if SPROUT_USE_TEMPLATE_ALIASES
#else // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<typename T, typename... Ts>
struct integer_pack
: public sprout::make_integer_sequence<T, sizeof...(Ts)>
{};
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
#endif // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_INTEGER_PACK_HPP

View file

@ -104,13 +104,13 @@ namespace sprout {
//
// integer_range
//
#if SPROUT_USE_TEMPLATE_ALIASES
#if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<
typename T, T First, T Last,
typename std::make_signed<T>::type Step = sprout::detail::integer_range_default_step<T, First, Last>::value
>
using integer_range = typename sprout::detail::integer_range<T, First, Last, Step>::type;
#else // #if SPROUT_USE_TEMPLATE_ALIASES
#else // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<
typename T, T First, T Last,
typename std::make_signed<T>::type Step = sprout::detail::integer_range_default_step<T, First, Last>::value
@ -118,7 +118,7 @@ namespace sprout {
struct integer_range
: public sprout::detail::integer_range<T, First, Last, Step>
{};
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
#endif // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_INTEGER_RANGE_HPP

View file

@ -16,15 +16,15 @@ namespace sprout {
//
// make_index_sequence
//
#if SPROUT_USE_TEMPLATE_ALIASES
#if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<sprout::uindex_t N>
using make_index_sequence = sprout::make_uindex_tuple<N>;
#else // #if SPROUT_USE_TEMPLATE_ALIASES
#else // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<sprout::uindex_t N>
struct make_index_sequence
: public sprout::make_uindex_tuple<N>
{};
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
#endif // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_MAKE_INDEX_SEQUENCE_HPP

View file

@ -18,13 +18,13 @@ namespace sprout {
// make_index_tuple
// make_uindex_tuple
//
#if SPROUT_USE_TEMPLATE_ALIASES
#if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<sprout::index_t N>
using make_index_tuple = sprout::make_integer_sequence<sprout::index_t, N>;
template<sprout::uindex_t N>
using make_uindex_tuple = sprout::make_integer_sequence<sprout::uindex_t, N>;
#else // #if SPROUT_USE_TEMPLATE_ALIASES
#else // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<sprout::index_t N>
struct make_index_tuple
: public sprout::enable_make_indexes<
@ -40,7 +40,7 @@ namespace sprout {
::template transfer<sprout::uindex_tuple<> >::type
>
{};
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
#endif // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_MAKE_INDEX_TUPLE_HPP

View file

@ -15,15 +15,15 @@ namespace sprout {
//
// make_integer_sequence
//
#if SPROUT_USE_TEMPLATE_ALIASES
#if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<typename T, T N>
using make_integer_sequence = sprout::integer_range<T, 0, N>;
#else // #if SPROUT_USE_TEMPLATE_ALIASES
#else // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
template<typename T, T N>
struct make_integer_sequence
: public sprout::integer_range<T, 0, N>
{};
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
#endif // #if SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES)
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_MAKE_INTEGER_SEQUENCE_HPP

View file

@ -38,7 +38,7 @@ namespace std {
typedef typename sprout::pack_element_c<I, T, Is...>::type type;
};
#if !SPROUT_USE_TEMPLATE_ALIASES
#if !(SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES))
//
// tuple_size
//
@ -68,7 +68,7 @@ namespace std {
struct tuple_element<I, sprout::uindex_tuple<Indexes...> >
: public std::tuple_element<I, sprout::integer_sequence<sprout::uindex_t, Indexes...> >
{};
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
#endif // #if !(SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES))
#if defined(__clang__)
# pragma clang diagnostic pop
@ -87,7 +87,7 @@ namespace sprout {
return type();
}
#if !SPROUT_USE_TEMPLATE_ALIASES
#if !(SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES))
//
// tuple_get
//
@ -109,7 +109,7 @@ namespace sprout {
typedef typename std::tuple_element<I, sprout::uindex_tuple<Indexes...> >::type type;
return type();
}
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
#endif // #if !(SPROUT_USE_TEMPLATE_ALIASES && !defined(SPROUT_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES))
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_TUPLE_HPP