diff --git a/sprout/config/compiler/intel.hpp b/sprout/config/compiler/intel.hpp index 4ec79bce..f2a392a0 100644 --- a/sprout/config/compiler/intel.hpp +++ b/sprout/config/compiler/intel.hpp @@ -48,5 +48,6 @@ #endif #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 diff --git a/sprout/detail/literal_def.hpp b/sprout/detail/literal_def.hpp index 8d895484..91a8dbcd 100644 --- a/sprout/detail/literal_def.hpp +++ b/sprout/detail/literal_def.hpp @@ -40,11 +40,11 @@ struct NAME { \ public: \ SPROUT_STATIC_CONSTEXPR sprout::basic_string 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 NAME::value \ - SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_OUTER(sprout::to_string(STRING)) + SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_OUTER(STRING) // // SPROUT_LITERAL_CHAR_DEF diff --git a/sprout/io.hpp b/sprout/io.hpp index 978e6ae5..b30ac257 100644 --- a/sprout/io.hpp +++ b/sprout/io.hpp @@ -70,7 +70,8 @@ namespace sprout { SPROUT_CONSTEXPR boolean_flag() SPROUT_DEFAULTED_DEFAULT_CONSTRUCTOR_DECL boolean_flag(boolean_flag const&) = default; SPROUT_CONSTEXPR boolean_flag(bool flag) - : flag_(flag) + : sprout::integral_constant() + , flag_(flag) {} SPROUT_CONSTEXPR boolean_flag operator()(bool flag) const { return boolean_flag(flag); diff --git a/sprout/string/string.hpp b/sprout/string/string.hpp index 5a3184b6..d09187a6 100644 --- a/sprout/string/string.hpp +++ b/sprout/string/string.hpp @@ -39,6 +39,7 @@ #if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION # include #endif +#include namespace sprout { namespace detail { @@ -317,15 +318,15 @@ namespace sprout { str, pos, NS_SSCRISK_CEL_OR_SPROUT::min(n, str.size() - pos) ) {} - template::type> - SPROUT_CONSTEXPR basic_string(T const(& arr)[N2]) + template + SPROUT_CONSTEXPR basic_string(T const(& arr)[N2] SPROUT_ENABLE_IF_WITH_ARRAY_IN_PARAMS((N2 - 1 <= N))) : impl_type( sprout::make_index_tuple::make(), arr, 0, sprout::char_traits_helper::traits_type>::length(arr, N2 - 1) ) {} - template::type> - SPROUT_CONSTEXPR basic_string(T const(& arr)[N2], size_type n) + template + SPROUT_CONSTEXPR basic_string(T const(& arr)[N2], size_type n SPROUT_ENABLE_IF_WITH_ARRAY_IN_PARAMS((N2 - 1 <= N))) : impl_type( sprout::make_index_tuple::make(), arr, 0, NS_SSCRISK_CEL_OR_SPROUT::min(n, sprout::char_traits_helper::traits_type>::length(arr, N2 - 1)) diff --git a/sprout/type_traits/integral_constant.hpp b/sprout/type_traits/integral_constant.hpp index 94dd19ff..47d45388 100644 --- a/sprout/type_traits/integral_constant.hpp +++ b/sprout/type_traits/integral_constant.hpp @@ -23,6 +23,10 @@ namespace sprout { typedef typename std::integral_constant::value_type value_type; typedef integral_constant type; 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 operator value_type() const SPROUT_NOEXCEPT { return std::integral_constant::value; diff --git a/sprout/workaround.hpp b/sprout/workaround.hpp index a9f07537..2bd10c23 100644 --- a/sprout/workaround.hpp +++ b/sprout/workaround.hpp @@ -11,5 +11,6 @@ #include #include #include +#include #endif // #ifndef SPROUT_WORKAROUND_HPP diff --git a/sprout/workaround/enable_if_with_array.hpp b/sprout/workaround/enable_if_with_array.hpp new file mode 100644 index 00000000..68215079 --- /dev/null +++ b/sprout/workaround/enable_if_with_array.hpp @@ -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 +#include + +// +// 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