workaround for ICC 15

This commit is contained in:
bolero-MURAKAMI 2015-05-08 20:11:30 +09:00
parent 1cb62e6250
commit 755ebf4311
7 changed files with 41 additions and 7 deletions

View file

@ -48,5 +48,6 @@
#endif #endif
#define SPROUT_WORKAROUND_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES #define SPROUT_WORKAROUND_NO_TEMPLATE_ARGUMENT_DEDUCTION_WITH_ALIASES
#define SPROUT_WORKAROUND_NO_DEFAULT_TEMPLATE_PARAMETERS_SFINAE_WITH_ARRAY
#endif // #ifndef SPROUT_CONFIG_COMPILER_INTEL_HPP #endif // #ifndef SPROUT_CONFIG_COMPILER_INTEL_HPP

View file

@ -40,11 +40,11 @@
struct NAME<ELEM> { \ struct NAME<ELEM> { \
public: \ public: \
SPROUT_STATIC_CONSTEXPR sprout::basic_string<ELEM, LENGTH> value \ SPROUT_STATIC_CONSTEXPR sprout::basic_string<ELEM, LENGTH> value \
SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_INNER(sprout::to_string(STRING)) \ SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_INNER(STRING) \
; \ ; \
}; \ }; \
SPROUT_CONSTEXPR_OR_CONST sprout::basic_string<ELEM, LENGTH> NAME<ELEM>::value \ SPROUT_CONSTEXPR_OR_CONST sprout::basic_string<ELEM, LENGTH> NAME<ELEM>::value \
SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_OUTER(sprout::to_string(STRING)) SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_OUTER(STRING)
// //
// SPROUT_LITERAL_CHAR_DEF // SPROUT_LITERAL_CHAR_DEF

View file

@ -70,7 +70,8 @@ namespace sprout {
SPROUT_CONSTEXPR boolean_flag() SPROUT_DEFAULTED_DEFAULT_CONSTRUCTOR_DECL SPROUT_CONSTEXPR boolean_flag() SPROUT_DEFAULTED_DEFAULT_CONSTRUCTOR_DECL
boolean_flag(boolean_flag const&) = default; boolean_flag(boolean_flag const&) = default;
SPROUT_CONSTEXPR boolean_flag(bool flag) SPROUT_CONSTEXPR boolean_flag(bool flag)
: flag_(flag) : sprout::integral_constant<sprout::io::flags::fmtflags, Flag>()
, flag_(flag)
{} {}
SPROUT_CONSTEXPR boolean_flag operator()(bool flag) const { SPROUT_CONSTEXPR boolean_flag operator()(bool flag) const {
return boolean_flag(flag); return boolean_flag(flag);

View file

@ -39,6 +39,7 @@
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION #if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
# include <sprout/iterator/index_iterator.hpp> # include <sprout/iterator/index_iterator.hpp>
#endif #endif
#include <sprout/workaround/enable_if_with_array.hpp>
namespace sprout { namespace sprout {
namespace detail { namespace detail {
@ -317,15 +318,15 @@ namespace sprout {
str, pos, NS_SSCRISK_CEL_OR_SPROUT::min(n, str.size() - pos) str, pos, NS_SSCRISK_CEL_OR_SPROUT::min(n, str.size() - pos)
) )
{} {}
template<std::size_t N2, typename Enable = typename std::enable_if<(N2 - 1 <= N)>::type> template<std::size_t N2 SPROUT_ENABLE_IF_WITH_ARRAY_IN_TEMPLATE_PARAMS((N2 - 1 <= N))>
SPROUT_CONSTEXPR basic_string(T const(& arr)[N2]) SPROUT_CONSTEXPR basic_string(T const(& arr)[N2] SPROUT_ENABLE_IF_WITH_ARRAY_IN_PARAMS((N2 - 1 <= N)))
: impl_type( : impl_type(
sprout::make_index_tuple<N2 - 1>::make(), sprout::make_index_tuple<N2 - 1>::make(),
arr, 0, sprout::char_traits_helper<typename sprout::basic_string<T, N2 - 1>::traits_type>::length(arr, N2 - 1) arr, 0, sprout::char_traits_helper<typename sprout::basic_string<T, N2 - 1>::traits_type>::length(arr, N2 - 1)
) )
{} {}
template<std::size_t N2, typename Enable = typename std::enable_if<(N2 - 1 <= N)>::type> template<std::size_t N2 SPROUT_ENABLE_IF_WITH_ARRAY_IN_TEMPLATE_PARAMS((N2 - 1 <= N))>
SPROUT_CONSTEXPR basic_string(T const(& arr)[N2], size_type n) SPROUT_CONSTEXPR basic_string(T const(& arr)[N2], size_type n SPROUT_ENABLE_IF_WITH_ARRAY_IN_PARAMS((N2 - 1 <= N)))
: impl_type( : impl_type(
sprout::make_index_tuple<N2 - 1>::make(), sprout::make_index_tuple<N2 - 1>::make(),
arr, 0, NS_SSCRISK_CEL_OR_SPROUT::min(n, sprout::char_traits_helper<typename sprout::basic_string<T, N2 - 1>::traits_type>::length(arr, N2 - 1)) arr, 0, NS_SSCRISK_CEL_OR_SPROUT::min(n, sprout::char_traits_helper<typename sprout::basic_string<T, N2 - 1>::traits_type>::length(arr, N2 - 1))

View file

@ -23,6 +23,10 @@ namespace sprout {
typedef typename std::integral_constant<T, V>::value_type value_type; typedef typename std::integral_constant<T, V>::value_type value_type;
typedef integral_constant type; typedef integral_constant type;
public: public:
#if defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
SPROUT_CONSTEXPR integral_constant() SPROUT_NOEXCEPT {}
integral_constant(integral_constant const&) = default;
#endif
SPROUT_CONSTEXPR SPROUT_CONSTEXPR
operator value_type() const SPROUT_NOEXCEPT { operator value_type() const SPROUT_NOEXCEPT {
return std::integral_constant<T, V>::value; return std::integral_constant<T, V>::value;

View file

@ -11,5 +11,6 @@
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/workaround/recursive_function_template.hpp> #include <sprout/workaround/recursive_function_template.hpp>
#include <sprout/workaround/base_class_construct.hpp> #include <sprout/workaround/base_class_construct.hpp>
#include <sprout/workaround/enable_if_with_array.hpp>
#endif // #ifndef SPROUT_WORKAROUND_HPP #endif // #ifndef SPROUT_WORKAROUND_HPP

View file

@ -0,0 +1,26 @@
/*=============================================================================
Copyright (c) 2011-2015 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_WORKAROUND_ENABLE_IF_WITH_ARRAY_HPP
#define SPROUT_WORKAROUND_ENABLE_IF_WITH_ARRAY_HPP
#include <type_traits>
#include <sprout/config.hpp>
//
// SPROUT_ENABLE_IF_WITH_ARRAY_IN_TEMPLATE_PARAMS
// SPROUT_ENABLE_IF_WITH_ARRAY_IN_PARAMS
//
#ifdef SPROUT_WORKAROUND_NO_DEFAULT_TEMPLATE_PARAMETERS_SFINAE_WITH_ARRAY
# define SPROUT_ENABLE_IF_WITH_ARRAY_IN_TEMPLATE_PARAMS(EXPR)
# define SPROUT_ENABLE_IF_WITH_ARRAY_IN_PARAMS(EXPR) , typename std::enable_if<(EXPR)>::type* = 0
#else
# define SPROUT_ENABLE_IF_WITH_ARRAY_IN_TEMPLATE_PARAMS(EXPR) , typename = typename std::enable_if<(EXPR)>::type
# define SPROUT_SFINAE_WITH_ARRAY_IN_PARAMS(EXPR)
#endif
#endif // #ifndef SPROUT_WORKAROUND_ENABLE_IF_WITH_ARRAY_HPP