diff --git a/sprout/bitset/bitset.hpp b/sprout/bitset/bitset.hpp index a93bdb25..b45a36ba 100644 --- a/sprout/bitset/bitset.hpp +++ b/sprout/bitset/bitset.hpp @@ -1310,12 +1310,12 @@ namespace sprout { to_string(Char zero, Char one = Char('1')) const { return to_string >(zero, one); } - template + template SPROUT_NON_CONSTEXPR std::basic_string, std::allocator > to_string() const { return to_string, std::allocator >(); } - template + template SPROUT_NON_CONSTEXPR std::basic_string, std::allocator > to_string(Char zero, Char one = Char('1')) const { return to_string, std::allocator >(zero, one); diff --git a/sprout/config/compiler/clang.hpp b/sprout/config/compiler/clang.hpp index 6c7eaaac..d76aeebb 100644 --- a/sprout/config/compiler/clang.hpp +++ b/sprout/config/compiler/clang.hpp @@ -44,14 +44,20 @@ # define SPROUT_NO_CXX11_UNICODE_LITERALS #endif -#if (!__has_feature(cxx_constexpr) || __cplusplus < 201305L || __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4)) +#if !__has_feature(cxx_relaxed_constexpr) # define SPROUT_NO_CXX14_CONSTEXPR #endif -#define SPROUT_NO_CXX14_VARIABLE_TEMPLATES +#if !__has_feature(cxx_variable_templates) +# define SPROUT_NO_CXX14_VARIABLE_TEMPLATES +#endif #if !defined(SPROUT_NO_CXX11_CONSTEXPR) # define SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE #endif +#if (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4)) +# define SPROUT_WORKAROUND_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT +#endif + #endif // #ifndef SPROUT_CONFIG_COMPILER_CLANG_HPP diff --git a/sprout/container/container_traits.hpp b/sprout/container/container_traits.hpp index 3fe9ee65..23546d3b 100644 --- a/sprout/container/container_traits.hpp +++ b/sprout/container/container_traits.hpp @@ -522,7 +522,7 @@ namespace sprout { , public sprout::detail::inherit_if_static_size > , public sprout::detail::container_nosy_fixed_size > { -#if SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT +#ifdef SPROUT_WORKAROUND_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT public: SPROUT_CONSTEXPR container_traits_facade() : SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(sprout::detail::inherit_if_value_type >) diff --git a/sprout/preprocessor.hpp b/sprout/preprocessor.hpp index 8c523582..5404dd17 100644 --- a/sprout/preprocessor.hpp +++ b/sprout/preprocessor.hpp @@ -14,5 +14,6 @@ #include #include #include +#include #endif // #ifndef SPROUT_PREPROCESSOR_HPP diff --git a/sprout/preprocessor/some_number.hpp b/sprout/preprocessor/some_number.hpp new file mode 100644 index 00000000..98abe878 --- /dev/null +++ b/sprout/preprocessor/some_number.hpp @@ -0,0 +1,26 @@ +/*============================================================================= + Copyright (c) 2011-2014 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_PREPROCESSOR_SOME_NUMBER_HPP +#define SPROUT_PREPROCESSOR_SOME_NUMBER_HPP + +#include +#include + +// +// SPROUT_PP_SOME_NUMBER +// SPROUT_PP_SOME_NUMBER_OR_EMPTY +// +#ifdef __COUNTER__ +# define SPROUT_PP_SOME_NUMBER() __COUNTER__ +# define SPROUT_PP_SOME_NUMBER_OR_EMPTY() SPROUT_PP_SOME_NUMBER() +#else +# define SPROUT_PP_SOME_NUMBER() __LINE__ +# define SPROUT_PP_SOME_NUMBER_OR_EMPTY() SPROUT_PP_EMPTY() +#endif + +#endif // #ifndef SPROUT_PREPROCESSOR_SOME_NUMBER_HPP diff --git a/sprout/preprocessor/unique_string.hpp b/sprout/preprocessor/unique_string.hpp index deb1577f..36bccfd6 100644 --- a/sprout/preprocessor/unique_string.hpp +++ b/sprout/preprocessor/unique_string.hpp @@ -11,6 +11,7 @@ #include #include #include +#include // // SPROUT_PP_UNIQUE_STRING @@ -18,12 +19,13 @@ // SPROUT_PP_UNIQUE_U16STRING // SPROUT_PP_UNIQUE_U32STRING // -#define SPROUT_PP_UNIQUE_STRING __DATE__ " " __TIME__ " : " __FILE__ ":" SPROUT_PP_STRINGIZE(__LINE__) +#define SPROUT_PP_UNIQUE_STRING \ + __DATE__ " " __TIME__ " : " __FILE__ ":" SPROUT_PP_STRINGIZE(__LINE__) SPROUT_PP_STRINGIZE(SPROUT_PP_SOME_NUMBER_OR_EMPTY()) #define SPROUT_PP_UNIQUE_WSTRING SPROUT_PP_WSTR(__DATE__) SPROUT_PP_WSTR(" ") SPROUT_PP_WSTR(__TIME__) \ - SPROUT_PP_WSTR(" : ") SPROUT_PP_WSTR(__FILE__) SPROUT_PP_WSTR(":") SPROUT_PP_WSTRINGIZE(__LINE__) + SPROUT_PP_WSTR(" : ") SPROUT_PP_WSTR(__FILE__) SPROUT_PP_WSTR(":") SPROUT_PP_WSTRINGIZE(__LINE__) SPROUT_PP_WSTRINGIZE(SPROUT_PP_SOME_NUMBER_OR_EMPTY()) #define SPROUT_PP_UNIQUE_U16STRING SPROUT_PP_U16STR(__DATE__) SPROUT_PP_U16STR(" ") SPROUT_PP_U16STR(__TIME__) \ - SPROUT_PP_U16STR(" : ") SPROUT_PP_U16STR(__FILE__) SPROUT_PP_U16STR(":") SPROUT_PP_U16STRINGIZE(__LINE__) + SPROUT_PP_U16STR(" : ") SPROUT_PP_U16STR(__FILE__) SPROUT_PP_U16STR(":") SPROUT_PP_U16STRINGIZE(__LINE__) SPROUT_PP_U16STRINGIZE(SPROUT_PP_SOME_NUMBER_OR_EMPTY()) #define SPROUT_PP_UNIQUE_U32STRING SPROUT_PP_U32STR(__DATE__) SPROUT_PP_U32STR(" ") SPROUT_PP_U32STR(__TIME__) \ - SPROUT_PP_U32STR(" : ") SPROUT_PP_U32STR(__FILE__) SPROUT_PP_U32STR(":") SPROUT_PP_U32STRINGIZE(__LINE__) + SPROUT_PP_U32STR(" : ") SPROUT_PP_U32STR(__FILE__) SPROUT_PP_U32STR(":") SPROUT_PP_U32STRINGIZE(__LINE__) SPROUT_PP_U32STRINGIZE(SPROUT_PP_SOME_NUMBER_OR_EMPTY()) #endif // #ifndef SPROUT_PREPROCESSOR_UNIQUE_STRING_HPP diff --git a/sprout/random/binomial_distribution.hpp b/sprout/random/binomial_distribution.hpp index 1265198e..8b6127ee 100644 --- a/sprout/random/binomial_distribution.hpp +++ b/sprout/random/binomial_distribution.hpp @@ -48,7 +48,7 @@ namespace sprout { SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_INNER(SPROUT_BINOMIAL_TABLE_DEF) ; }; - template + template SPROUT_CONSTEXPR_OR_CONST typename sprout::random::detail::binomial_table::table_type sprout::random::detail::binomial_table::table SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_OUTER(SPROUT_BINOMIAL_TABLE_DEF) diff --git a/sprout/random/uniform_smallint.hpp b/sprout/random/uniform_smallint.hpp index 57f26926..294607a8 100644 --- a/sprout/random/uniform_smallint.hpp +++ b/sprout/random/uniform_smallint.hpp @@ -108,7 +108,7 @@ namespace sprout { : sprout::random::detail::add()(static_cast(val % (static_cast(range) + 1)), min_) ; } - template + template SPROUT_CXX14_CONSTEXPR result_type generate( Engine& eng, std::false_type @@ -215,7 +215,7 @@ namespace sprout { static_cast(sprout::random::result(rnd) * (static_cast(range) + 1)) ); } - template + template SPROUT_CONSTEXPR sprout::random::random_result generate( Engine const& eng, std::false_type diff --git a/sprout/type/string/to_string.hpp b/sprout/type/string/to_string.hpp index 33e47254..cdb37887 100644 --- a/sprout/type/string/to_string.hpp +++ b/sprout/type/string/to_string.hpp @@ -19,6 +19,7 @@ #include #include #include +#include namespace sprout { namespace types { @@ -69,8 +70,8 @@ namespace sprout { // // SPROUT_TYPES_STRING_TYPEDEF // -# define SPROUT_TYPES_STRING_TYPEDEF(SOURCE, TYPE) \ - struct SPROUT_PP_CAT(SPROUT_TYPES_STRING_TYPEDEF_PROXY_, __LINE__) { \ +# define SPROUT_TYPES_STRING_TYPEDEF_IMPL(SOURCE, TYPE, NUM) \ + struct SPROUT_PP_CAT(SPROUT_TYPES_STRING_TYPEDEF_PROXY_, NUM) { \ private: \ typedef typename std::remove_reference::type src_type; \ typedef sprout::types::detail::string_typedef_impl::value> impl_type; \ @@ -81,7 +82,9 @@ namespace sprout { return impl_type()(SOURCE); \ } \ }; \ - typedef typename sprout::types::to_string::type TYPE + typedef typename sprout::types::to_string::type TYPE +# define SPROUT_TYPES_STRING_TYPEDEF(SOURCE, TYPE) \ + SPROUT_TYPES_STRING_TYPEDEF_IMPL(SOURCE, TYPE, SPROUT_PP_SOME_NUMBER()) } // namespace types } // namespace sprout diff --git a/sprout/type_traits/has_xxx.hpp b/sprout/type_traits/has_xxx.hpp index cc735593..92953786 100644 --- a/sprout/type_traits/has_xxx.hpp +++ b/sprout/type_traits/has_xxx.hpp @@ -10,6 +10,7 @@ #include #include +#include #include // @@ -17,26 +18,28 @@ // SPROUT_HAS_XXX_TYPE_DEF_LAZY // #if defined(_MSC_VER) -#define SPROUT_HAS_XXX_TYPE_DEF(NAME, TYPE) \ +#define SPROUT_HAS_XXX_TYPE_DEF_IMPL(NAME, TYPE, NUM) \ template \ - sprout::true_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), __LINE__)(int); \ + sprout::true_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), NUM)(int); \ template \ - sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), __LINE__)(long); \ - template(0))> \ + sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), NUM)(long); \ + template(0))> \ struct NAME \ : public Base_ \ {} #else -#define SPROUT_HAS_XXX_TYPE_DEF(NAME, TYPE) \ +#define SPROUT_HAS_XXX_TYPE_DEF_IMPL(NAME, TYPE, NUM) \ template \ - sprout::true_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), __LINE__)(int); \ + sprout::true_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), NUM)(int); \ template \ - sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), __LINE__)(long); \ + sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), NUM)(long); \ template \ struct NAME \ - : public decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), __LINE__)(0)) \ + : public decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), NUM)(0)) \ {} #endif +#define SPROUT_HAS_XXX_TYPE_DEF(NAME, TYPE) \ + SPROUT_HAS_XXX_TYPE_DEF_IMPL(NAME, TYPE, SPROUT_PP_SOME_NUMBER()) #define SPROUT_HAS_XXX_TYPE_DEF_LAZY(TYPE) \ SPROUT_HAS_XXX_TYPE_DEF(SPROUT_PP_CAT(has_, TYPE), TYPE) @@ -45,26 +48,28 @@ // SPROUT_HAS_XXX_VALUE_DEF_LAZY // #if defined(_MSC_VER) -#define SPROUT_HAS_XXX_VALUE_DEF(NAME, VALUE) \ +#define SPROUT_HAS_XXX_VALUE_DEF_IMPL(NAME, VALUE, NUM) \ template \ - sprout::true_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), __LINE__)(int); \ + sprout::true_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), NUM)(int); \ template \ - sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), __LINE__)(long); \ - template(0))> \ + sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), NUM)(long); \ + template(0))> \ struct NAME \ : public Base_ \ {} #else -#define SPROUT_HAS_XXX_VALUE_DEF(NAME, VALUE) \ +#define SPROUT_HAS_XXX_VALUE_DEF_IMPL(NAME, VALUE, NUM) \ template \ - sprout::true_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), __LINE__)(int); \ + sprout::true_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), NUM)(int); \ template \ - sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), __LINE__)(long); \ + sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), NUM)(long); \ template \ struct NAME \ - : public decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), __LINE__)(0)) \ + : public decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), NUM)(0)) \ {} #endif +#define SPROUT_HAS_XXX_VALUE_DEF(NAME, VALUE) \ + SPROUT_HAS_XXX_VALUE_DEF_IMPL(NAME, VALUE, SPROUT_PP_SOME_NUMBER()) #define SPROUT_HAS_XXX_VALUE_DEF_LAZY(VALUE) \ SPROUT_HAS_XXX_VALUE_DEF(SPROUT_PP_CAT(has_, VALUE), VALUE) @@ -73,26 +78,28 @@ // SPROUT_HAS_XXX_TEMPLATE_DEF_LAZY // #if defined(_MSC_VER) -#define SPROUT_HAS_XXX_TEMPLATE_DEF(NAME, TEMPLATE) \ +#define SPROUT_HAS_XXX_TEMPLATE_DEF_IMPL(NAME, TEMPLATE, NUM) \ template class = T::template TEMPLATE> \ - sprout::true_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), __LINE__)(int); \ + sprout::true_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), NUM)(int); \ template \ - sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), __LINE__)(long); \ - template(0))> \ + sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), NUM)(long); \ + template(0))> \ struct NAME \ : public Base_ \ {} #else -#define SPROUT_HAS_XXX_TEMPLATE_DEF(NAME, TEMPLATE) \ +#define SPROUT_HAS_XXX_TEMPLATE_DEF_IMPL(NAME, TEMPLATE, NUM) \ template class = T::template TEMPLATE> \ - sprout::true_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), __LINE__)(int); \ + sprout::true_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), NUM)(int); \ template \ - sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), __LINE__)(long); \ + sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), NUM)(long); \ template \ struct NAME \ - : public decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), __LINE__)(0)) \ + : public decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), NUM)(0)) \ {} #endif +#define SPROUT_HAS_XXX_TEMPLATE_DEF(NAME, TEMPLATE) \ + SPROUT_HAS_XXX_TEMPLATE_DEF_IMPL(NAME, TEMPLATE, SPROUT_PP_SOME_NUMBER()) #define SPROUT_HAS_XXX_TEMPLATE_DEF_LAZY(TEMPLATE) \ SPROUT_HAS_XXX_TEMPLATE_DEF(SPROUT_PP_CAT(has_, TEMPLATE), TEMPLATE) diff --git a/sprout/type_traits/inherit_if_xxx.hpp b/sprout/type_traits/inherit_if_xxx.hpp index c1091c29..80f36bfa 100644 --- a/sprout/type_traits/inherit_if_xxx.hpp +++ b/sprout/type_traits/inherit_if_xxx.hpp @@ -14,24 +14,27 @@ #include #include #include +#include #include // // SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF // SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF_LAZY // -#define SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF(NAME, ALIAS, TYPE) \ - SPROUT_HAS_XXX_TYPE_DEF(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_type_def_impl_has_, TYPE), __LINE__), TYPE); \ +#define SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF_IMPL(NAME, ALIAS, TYPE, NUM) \ + SPROUT_HAS_XXX_TYPE_DEF(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_type_def_impl_has_, TYPE), NUM), TYPE); \ template \ struct NAME {}; \ template \ struct NAME< \ T, \ - typename std::enable_if::value>::type \ + typename std::enable_if::value>::type \ > { \ public: \ typedef typename T::TYPE ALIAS; \ } +#define SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF(NAME, ALIAS, TYPE) \ + SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF_IMPL(NAME, ALIAS, TYPE, SPROUT_PP_SOME_NUMBER()) #define SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF_LAZY(ALIAS, TYPE) \ SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(inherit_, ALIAS), _if_), TYPE), ALIAS, TYPE) @@ -49,14 +52,14 @@ // SPROUT_INHERIT_ALIAS_IF_XXX_CONSTANT_DEF_LAZY // #if defined(_MSC_VER) -#define SPROUT_INHERIT_ALIAS_IF_XXX_CONSTANT_DEF(NAME, ALIAS, CONSTANT) \ - SPROUT_HAS_XXX_VALUE_DEF(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_constant_def_impl_has_, CONSTANT), __LINE__), CONSTANT); \ +#define SPROUT_INHERIT_ALIAS_IF_XXX_CONSTANT_DEF_IMPL(NAME, ALIAS, CONSTANT, NUM) \ + SPROUT_HAS_XXX_VALUE_DEF(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_constant_def_impl_has_, CONSTANT), NUM), CONSTANT); \ template \ struct NAME {}; \ template \ struct NAME< \ T, \ - typename std::enable_if::value>::type \ + typename std::enable_if::value>::type \ > { \ public: \ SPROUT_STATIC_CONSTEXPR std::size_t ALIAS = T::CONSTANT; \ @@ -64,17 +67,17 @@ template \ SPROUT_CONSTEXPR_OR_CONST std::size_t NAME< \ T, \ - typename std::enable_if::value>::type \ + typename std::enable_if::value>::type \ >::ALIAS #else -#define SPROUT_INHERIT_ALIAS_IF_XXX_CONSTANT_DEF(NAME, ALIAS, CONSTANT) \ - SPROUT_HAS_XXX_VALUE_DEF(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_constant_def_impl_has_, CONSTANT), __LINE__), CONSTANT); \ +#define SPROUT_INHERIT_ALIAS_IF_XXX_CONSTANT_DEF_IMPL(NAME, ALIAS, CONSTANT, NUM) \ + SPROUT_HAS_XXX_VALUE_DEF(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_constant_def_impl_has_, CONSTANT), NUM), CONSTANT); \ template \ struct NAME {}; \ template \ struct NAME< \ T, \ - typename std::enable_if::value>::type \ + typename std::enable_if::value>::type \ > { \ public: \ SPROUT_STATIC_CONSTEXPR typename std::decay::type ALIAS = T::CONSTANT; \ @@ -82,9 +85,11 @@ template \ SPROUT_CONSTEXPR_OR_CONST typename std::decay::type NAME< \ T, \ - typename std::enable_if::value>::type \ + typename std::enable_if::value>::type \ >::ALIAS #endif +#define SPROUT_INHERIT_ALIAS_IF_XXX_CONSTANT_DEF(NAME, ALIAS, CONSTANT) \ + SPROUT_INHERIT_ALIAS_IF_XXX_CONSTANT_DEF_IMPL(NAME, ALIAS, CONSTANT, SPROUT_PP_SOME_NUMBER()) #define SPROUT_INHERIT_ALIAS_IF_XXX_CONSTANT_DEF_LAZY(ALIAS, CONSTANT) \ SPROUT_INHERIT_ALIAS_IF_XXX_CONSTANT_DEF(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(inherit_, ALIAS), _if_), CONSTANT), ALIAS, CONSTANT) diff --git a/sprout/type_traits/std_value_variables.hpp b/sprout/type_traits/std_value_variables.hpp index 494c293f..5e6f7ad8 100644 --- a/sprout/type_traits/std_value_variables.hpp +++ b/sprout/type_traits/std_value_variables.hpp @@ -157,7 +157,7 @@ namespace sprout { template SPROUT_STATIC_CONSTEXPR bool is_base_of_v = sprout::is_base_of::value; template - SPROUT_STATIC_CONSTEXPR bool is_convertible_v = sprout::is_convertible>::value; + SPROUT_STATIC_CONSTEXPR bool is_convertible_v = sprout::is_convertible::value; #endif // #if SPROUT_USE_VARIABLE_TEMPLATES } // namespace sprout diff --git a/sprout/workaround/base_class_construct.hpp b/sprout/workaround/base_class_construct.hpp index f9c7fe25..ebc6a3bc 100644 --- a/sprout/workaround/base_class_construct.hpp +++ b/sprout/workaround/base_class_construct.hpp @@ -9,24 +9,12 @@ #define SPROUT_WORKAROUND_BASE_CLASS_CONSTRUCT_HPP #include -#include - -// -// SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT -// -#ifndef SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT -# if SPROUT_CLANG_OR_LATER(3, 4, 0) -# define SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT (1) -# else -# define SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT (0) -# endif -#endif // // SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT // #ifndef SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT -# if SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT +# ifdef SPROUT_WORKAROUND_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT # define SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(base) base() # else # define SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(base) diff --git a/sprout/workaround/detail/uniform_int_distribution.hpp b/sprout/workaround/detail/uniform_int_distribution.hpp index e42c510c..431d0d4d 100644 --- a/sprout/workaround/detail/uniform_int_distribution.hpp +++ b/sprout/workaround/detail/uniform_int_distribution.hpp @@ -9,15 +9,12 @@ #define SPROUT_WORKAROUND_DETAIL_UNIFORM_INT_DISTRIBUTION_HPP #include -#ifdef SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE -# include -#else -# include -#endif #ifdef SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE +# include # define SPROUT_WORKAROUND_DETAIL_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_smallint #else +# include # define SPROUT_WORKAROUND_DETAIL_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_int_distribution #endif diff --git a/sprout/workaround/recursive_function_template.hpp b/sprout/workaround/recursive_function_template.hpp index b3c2a241..a0477777 100644 --- a/sprout/workaround/recursive_function_template.hpp +++ b/sprout/workaround/recursive_function_template.hpp @@ -14,17 +14,14 @@ #include #include #include +#include // // SPROUT_RECURSIVE_FUNCTION_TEMPLATE_INSTANTIATION_LIMIT // #ifndef SPROUT_RECURSIVE_FUNCTION_TEMPLATE_INSTANTIATION_LIMIT -# if defined(__clang__) -# if (__clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ <= 2)) -# define SPROUT_RECURSIVE_FUNCTION_TEMPLATE_INSTANTIATION_LIMIT 512 -# else -# define SPROUT_RECURSIVE_FUNCTION_TEMPLATE_INSTANTIATION_LIMIT 256 -# endif +# if SPROUT_CLANG_OR_LATER(3, 3, 0) +# define SPROUT_RECURSIVE_FUNCTION_TEMPLATE_INSTANTIATION_LIMIT 256 # else # define SPROUT_RECURSIVE_FUNCTION_TEMPLATE_INSTANTIATION_LIMIT 512 # endif diff --git a/testspr/algorithm.hpp b/testspr/algorithm.hpp index 02193142..2f05bd1c 100644 --- a/testspr/algorithm.hpp +++ b/testspr/algorithm.hpp @@ -45,7 +45,7 @@ namespace testspr { // // is_found // - template + template inline SPROUT_CONSTEXPR bool is_found(InputIterator first, InputIterator last, T const& value) { return first == last ? false