mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
add SPROUT_PP_SOME_NUMBER
This commit is contained in:
parent
12e12373d0
commit
b4b870209b
16 changed files with 108 additions and 76 deletions
|
@ -1310,12 +1310,12 @@ namespace sprout {
|
|||
to_string(Char zero, Char one = Char('1')) const {
|
||||
return to_string<Char, Traits, std::allocator<Char> >(zero, one);
|
||||
}
|
||||
template<class Char>
|
||||
template<typename Char>
|
||||
SPROUT_NON_CONSTEXPR std::basic_string<Char, std::char_traits<Char>, std::allocator<Char> >
|
||||
to_string() const {
|
||||
return to_string<Char, std::char_traits<Char>, std::allocator<Char> >();
|
||||
}
|
||||
template<class Char>
|
||||
template<typename Char>
|
||||
SPROUT_NON_CONSTEXPR std::basic_string<Char, std::char_traits<Char>, std::allocator<Char> >
|
||||
to_string(Char zero, Char one = Char('1')) const {
|
||||
return to_string<Char, std::char_traits<Char>, std::allocator<Char> >(zero, one);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -522,7 +522,7 @@ namespace sprout {
|
|||
, public sprout::detail::inherit_if_static_size<sprout::container_traits<Container> >
|
||||
, public sprout::detail::container_nosy_fixed_size<sprout::container_traits<Container> >
|
||||
{
|
||||
#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<sprout::container_traits<Container> >)
|
||||
|
|
|
@ -14,5 +14,6 @@
|
|||
#include <sprout/preprocessor/str_all.hpp>
|
||||
#include <sprout/preprocessor/unique_string.hpp>
|
||||
#include <sprout/preprocessor/empty.hpp>
|
||||
#include <sprout/preprocessor/some_number.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_PREPROCESSOR_HPP
|
||||
|
|
26
sprout/preprocessor/some_number.hpp
Normal file
26
sprout/preprocessor/some_number.hpp
Normal file
|
@ -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 <sprout/config.hpp>
|
||||
#include <sprout/preprocessor/empty.hpp>
|
||||
|
||||
//
|
||||
// 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
|
|
@ -11,6 +11,7 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/preprocessor/stringize_all.hpp>
|
||||
#include <sprout/preprocessor/str_all.hpp>
|
||||
#include <sprout/preprocessor/some_number.hpp>
|
||||
|
||||
//
|
||||
// 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
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace sprout {
|
|||
SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_INNER(SPROUT_BINOMIAL_TABLE_DEF)
|
||||
;
|
||||
};
|
||||
template<class RealType>
|
||||
template<typename RealType>
|
||||
SPROUT_CONSTEXPR_OR_CONST typename sprout::random::detail::binomial_table<RealType>::table_type
|
||||
sprout::random::detail::binomial_table<RealType>::table
|
||||
SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_OUTER(SPROUT_BINOMIAL_TABLE_DEF)
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace sprout {
|
|||
: sprout::random::detail::add<range_type, result_type>()(static_cast<range_type>(val % (static_cast<base_result>(range) + 1)), min_)
|
||||
;
|
||||
}
|
||||
template<class Engine>
|
||||
template<typename Engine>
|
||||
SPROUT_CXX14_CONSTEXPR result_type generate(
|
||||
Engine& eng,
|
||||
std::false_type
|
||||
|
@ -215,7 +215,7 @@ namespace sprout {
|
|||
static_cast<RangeType>(sprout::random::result(rnd) * (static_cast<base_result>(range) + 1))
|
||||
);
|
||||
}
|
||||
template<class Engine>
|
||||
template<typename Engine>
|
||||
SPROUT_CONSTEXPR sprout::random::random_result<Engine, uniform_smallint> generate(
|
||||
Engine const& eng,
|
||||
std::false_type
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <sprout/container/begin.hpp>
|
||||
#include <sprout/iterator/next.hpp>
|
||||
#include <sprout/preprocessor/cat.hpp>
|
||||
#include <sprout/preprocessor/some_number.hpp>
|
||||
|
||||
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<decltype(SOURCE)>::type src_type; \
|
||||
typedef sprout::types::detail::string_typedef_impl<src_type, std::is_array<src_type>::value> impl_type; \
|
||||
|
@ -81,7 +82,9 @@ namespace sprout {
|
|||
return impl_type()(SOURCE); \
|
||||
} \
|
||||
}; \
|
||||
typedef typename sprout::types::to_string<SPROUT_PP_CAT(SPROUT_TYPES_STRING_TYPEDEF_PROXY_, __LINE__)>::type TYPE
|
||||
typedef typename sprout::types::to_string<SPROUT_PP_CAT(SPROUT_TYPES_STRING_TYPEDEF_PROXY_, NUM)>::type TYPE
|
||||
# define SPROUT_TYPES_STRING_TYPEDEF(SOURCE, TYPE) \
|
||||
SPROUT_TYPES_STRING_TYPEDEF_IMPL(SOURCE, TYPE, SPROUT_PP_SOME_NUMBER())
|
||||
} // namespace types
|
||||
} // namespace sprout
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/preprocessor/cat.hpp>
|
||||
#include <sprout/preprocessor/some_number.hpp>
|
||||
#include <sprout/type_traits/integral_constant.hpp>
|
||||
|
||||
//
|
||||
|
@ -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<typename T, typename = typename T::TYPE> \
|
||||
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<typename T> \
|
||||
sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), __LINE__)(long); \
|
||||
template<typename T, typename Base_ = decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), __LINE__)<T>(0))> \
|
||||
sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), NUM)(long); \
|
||||
template<typename T, typename Base_ = decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), NUM)<T>(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<typename T, typename = typename T::TYPE> \
|
||||
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<typename T> \
|
||||
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<typename T> \
|
||||
struct NAME \
|
||||
: public decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), __LINE__)<T>(0)) \
|
||||
: public decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TYPE), NAME), NUM)<T>(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<typename T, decltype(&T::VALUE) = &T::VALUE> \
|
||||
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<typename T> \
|
||||
sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), __LINE__)(long); \
|
||||
template<typename T, typename Base_ = decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), __LINE__)<T>(0))> \
|
||||
sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), NUM)(long); \
|
||||
template<typename T, typename Base_ = decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), NUM)<T>(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<typename T, decltype(&T::VALUE) = &T::VALUE> \
|
||||
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<typename T> \
|
||||
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<typename T> \
|
||||
struct NAME \
|
||||
: public decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), __LINE__)<T>(0)) \
|
||||
: public decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_value_, VALUE), NAME), NUM)<T>(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<typename T, template<typename...> 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<typename T> \
|
||||
sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), __LINE__)(long); \
|
||||
template<typename T, typename Base_ = decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), __LINE__)<T>(0))> \
|
||||
sprout::false_type SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), NUM)(long); \
|
||||
template<typename T, typename Base_ = decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), NUM)<T>(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<typename T, template<typename...> 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<typename T> \
|
||||
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<typename T> \
|
||||
struct NAME \
|
||||
: public decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), __LINE__)<T>(0)) \
|
||||
: public decltype(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_has_xxx_impl_check_type_, TEMPLATE), NAME), NUM)<T>(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)
|
||||
|
||||
|
|
|
@ -14,24 +14,27 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/preprocessor/cat.hpp>
|
||||
#include <sprout/preprocessor/some_number.hpp>
|
||||
#include <sprout/type_traits/has_xxx.hpp>
|
||||
|
||||
//
|
||||
// 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<typename T, typename = void> \
|
||||
struct NAME {}; \
|
||||
template<typename T> \
|
||||
struct NAME< \
|
||||
T, \
|
||||
typename std::enable_if<SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_type_def_impl_has_, TYPE), __LINE__)<T>::value>::type \
|
||||
typename std::enable_if<SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_type_def_impl_has_, TYPE), NUM)<T>::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<typename T, typename = void> \
|
||||
struct NAME {}; \
|
||||
template<typename T> \
|
||||
struct NAME< \
|
||||
T, \
|
||||
typename std::enable_if<SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_constant_def_impl_has_, CONSTANT), __LINE__)<T>::value>::type \
|
||||
typename std::enable_if<SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_constant_def_impl_has_, CONSTANT), NUM)<T>::value>::type \
|
||||
> { \
|
||||
public: \
|
||||
SPROUT_STATIC_CONSTEXPR std::size_t ALIAS = T::CONSTANT; \
|
||||
|
@ -64,17 +67,17 @@
|
|||
template<typename T> \
|
||||
SPROUT_CONSTEXPR_OR_CONST std::size_t NAME< \
|
||||
T, \
|
||||
typename std::enable_if<SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_constant_def_impl_has_, CONSTANT), __LINE__)<T>::value>::type \
|
||||
typename std::enable_if<SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_constant_def_impl_has_, CONSTANT), NUM)<T>::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<typename T, typename = void> \
|
||||
struct NAME {}; \
|
||||
template<typename T> \
|
||||
struct NAME< \
|
||||
T, \
|
||||
typename std::enable_if<SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_constant_def_impl_has_, CONSTANT), __LINE__)<T>::value>::type \
|
||||
typename std::enable_if<SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_constant_def_impl_has_, CONSTANT), NUM)<T>::value>::type \
|
||||
> { \
|
||||
public: \
|
||||
SPROUT_STATIC_CONSTEXPR typename std::decay<decltype(T::CONSTANT)>::type ALIAS = T::CONSTANT; \
|
||||
|
@ -82,9 +85,11 @@
|
|||
template<typename T> \
|
||||
SPROUT_CONSTEXPR_OR_CONST typename std::decay<decltype(T::CONSTANT)>::type NAME< \
|
||||
T, \
|
||||
typename std::enable_if<SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_constant_def_impl_has_, CONSTANT), __LINE__)<T>::value>::type \
|
||||
typename std::enable_if<SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_constant_def_impl_has_, CONSTANT), NUM)<T>::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)
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace sprout {
|
|||
template<typename From, typename To>
|
||||
SPROUT_STATIC_CONSTEXPR bool is_base_of_v = sprout::is_base_of<From, To>::value;
|
||||
template<typename From, typename To>
|
||||
SPROUT_STATIC_CONSTEXPR bool is_convertible_v = sprout::is_convertible<From, To>>::value;
|
||||
SPROUT_STATIC_CONSTEXPR bool is_convertible_v = sprout::is_convertible<From, To>::value;
|
||||
#endif // #if SPROUT_USE_VARIABLE_TEMPLATES
|
||||
} // namespace sprout
|
||||
|
||||
|
|
|
@ -9,24 +9,12 @@
|
|||
#define SPROUT_WORKAROUND_BASE_CLASS_CONSTRUCT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/detail/predef.hpp>
|
||||
|
||||
//
|
||||
// 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)
|
||||
|
|
|
@ -9,15 +9,12 @@
|
|||
#define SPROUT_WORKAROUND_DETAIL_UNIFORM_INT_DISTRIBUTION_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#ifdef SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE
|
||||
# include <sprout/random/uniform_smallint.hpp>
|
||||
#else
|
||||
# include <sprout/random/uniform_int_distribution.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE
|
||||
# include <sprout/random/uniform_smallint.hpp>
|
||||
# define SPROUT_WORKAROUND_DETAIL_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_smallint
|
||||
#else
|
||||
# include <sprout/random/uniform_int_distribution.hpp>
|
||||
# define SPROUT_WORKAROUND_DETAIL_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_int_distribution
|
||||
#endif
|
||||
|
||||
|
|
|
@ -14,17 +14,14 @@
|
|||
#include <sprout/utility/any_convertible.hpp>
|
||||
#include <sprout/type_traits/enabler_if.hpp>
|
||||
#include <sprout/preprocessor/stringize.hpp>
|
||||
#include <sprout/detail/predef.hpp>
|
||||
|
||||
//
|
||||
// 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
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace testspr {
|
|||
//
|
||||
// is_found
|
||||
//
|
||||
template<class InputIterator, typename T>
|
||||
template<typename InputIterator, typename T>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_found(InputIterator first, InputIterator last, T const& value) {
|
||||
return first == last ? false
|
||||
|
|
Loading…
Reference in a new issue