Regenerate fusion::fold family.

This commit is contained in:
Kohei Takahashi
2015-11-14 20:34:41 +09:00
parent 7cf404d096
commit 1c05cfc795
5 changed files with 162 additions and 23 deletions

View File

@ -9,6 +9,8 @@
==============================================================================*/ ==============================================================================*/
#include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/cat.hpp>
#define FUSION_HASH #
#ifdef BOOST_FUSION_REVERSE_FOLD #ifdef BOOST_FUSION_REVERSE_FOLD
# ifdef BOOST_FUSION_ITER_FOLD # ifdef BOOST_FUSION_ITER_FOLD
# define BOOST_FUSION_FOLD_NAME reverse_iter_fold # define BOOST_FUSION_FOLD_NAME reverse_iter_fold
@ -42,20 +44,35 @@
# define BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(IT) fusion::deref(IT) # define BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(IT) fusion::deref(IT)
#endif #endif
#if (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
FUSION_HASH if BOOST_WORKAROUND BOOST_PREVENT_MACRO_SUBSTITUTION (BOOST_MSVC, < 1500)
FUSION_HASH define BOOST_FUSION_FOLD_IMPL_ENABLER(T) void
FUSION_HASH else
FUSION_HASH define BOOST_FUSION_FOLD_IMPL_ENABLER(T) typename T::type
FUSION_HASH endif
#else
# if BOOST_WORKAROUND(BOOST_MSVC, < 1500) # if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
# define BOOST_FUSION_FOLD_IMPL_ENABLER(T) void # define BOOST_FUSION_FOLD_IMPL_ENABLER(T) void
# else # else
# define BOOST_FUSION_FOLD_IMPL_ENABLER(T) typename T::type # define BOOST_FUSION_FOLD_IMPL_ENABLER(T) typename T::type
# endif # endif
#endif
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
namespace detail namespace detail
{ {
template<int SeqSize, typename It, typename State, typename F, typename = void template<int SeqSize, typename It, typename State, typename F, typename = void
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500) #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if BOOST_WORKAROUND BOOST_PREVENT_MACRO_SUBSTITUTION (BOOST_MSVC, < 1500)
#endif
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500) || \
(defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
// Dirty hack: those compilers cannot choose exactly one partial specialization. // Dirty hack: those compilers cannot choose exactly one partial specialization.
, bool = SeqSize == 0 , bool = SeqSize == 0
#endif
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH endif
#endif #endif
> >
struct BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME) struct BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)
@ -64,8 +81,15 @@ namespace boost { namespace fusion
template<typename It, typename State, typename F> template<typename It, typename State, typename F>
struct BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<0,It,State,F struct BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<0,It,State,F
, typename boost::enable_if_has_type<BOOST_FUSION_FOLD_IMPL_ENABLER(State)>::type , typename boost::enable_if_has_type<BOOST_FUSION_FOLD_IMPL_ENABLER(State)>::type
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500) #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if BOOST_WORKAROUND BOOST_PREVENT_MACRO_SUBSTITUTION (BOOST_MSVC, < 1500)
#endif
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500) || \
(defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
, true , true
#endif
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH endif
#endif #endif
> >
{ {
@ -75,17 +99,35 @@ namespace boost { namespace fusion
template<int SeqSize, typename It, typename State, typename F> template<int SeqSize, typename It, typename State, typename F>
struct BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<SeqSize,It,State,F struct BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<SeqSize,It,State,F
, typename boost::enable_if_has_type< , typename boost::enable_if_has_type<
#if BOOST_WORKAROUND(BOOST_MSVC, == 1500) #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if BOOST_WORKAROUND BOOST_PREVENT_MACRO_SUBSTITUTION (BOOST_MSVC, == 1500)
#endif
#if BOOST_WORKAROUND(BOOST_MSVC, == 1500) || \
(defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
// Following SFINAE enables to avoid MSVC 9's partial specialization // Following SFINAE enables to avoid MSVC 9's partial specialization
// ambiguous bug but MSVC 8 don't compile, and moreover MSVC 8 style // ambiguous bug but MSVC 8 don't compile, and moreover MSVC 8 style
// workaround won't work with MSVC 9. // workaround won't work with MSVC 9.
typename boost::disable_if_c<SeqSize == 0, State>::type::type typename boost::disable_if_c<SeqSize == 0, State>::type::type
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH else
BOOST_FUSION_FOLD_IMPL_ENABLER(State)
#endif
#else #else
BOOST_FUSION_FOLD_IMPL_ENABLER(State) BOOST_FUSION_FOLD_IMPL_ENABLER(State)
#endif
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH endif
#endif #endif
>::type >::type
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500) #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if BOOST_WORKAROUND BOOST_PREVENT_MACRO_SUBSTITUTION (BOOST_MSVC, < 1500)
#endif
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500) || \
(defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
, false , false
#endif
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH endif
#endif #endif
> >
: BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)< : BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<
@ -249,3 +291,4 @@ namespace boost { namespace fusion
#undef BOOST_FUSION_FOLD_IMPL_FIRST_IT_TRANSFORM #undef BOOST_FUSION_FOLD_IMPL_FIRST_IT_TRANSFORM
#undef BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM #undef BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM
#undef BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM #undef BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM
#undef FUSION_HASH

View File

@ -8,25 +8,49 @@
This is an auto-generated file. Do not edit! This is an auto-generated file. Do not edit!
==============================================================================*/ ==============================================================================*/
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
# define BOOST_FUSION_FOLD_IMPL_ENABLER(T) void
# else
# define BOOST_FUSION_FOLD_IMPL_ENABLER(T) typename T::type
# endif
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
namespace detail namespace detail
{ {
template<int SeqSize, typename It, typename State, typename F, typename = void> template<int SeqSize, typename It, typename State, typename F, typename = void
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
, bool = SeqSize == 0
# endif
>
struct result_of_it_fold struct result_of_it_fold
{}; {};
template<typename It, typename State, typename F> template<typename It, typename State, typename F>
struct result_of_it_fold<0,It,State,F struct result_of_it_fold<0,It,State,F
, typename boost::enable_if_has_type<typename State::type>::type> , typename boost::enable_if_has_type<BOOST_FUSION_FOLD_IMPL_ENABLER(State)>::type
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
, true
# endif
>
{ {
typedef typename State::type type; typedef typename State::type type;
}; };
template<int SeqSize, typename It, typename State, typename F> template<int SeqSize, typename It, typename State, typename F>
struct result_of_it_fold<SeqSize,It,State,F struct result_of_it_fold<SeqSize,It,State,F
, typename boost::enable_if_has_type< , typename boost::enable_if_has_type<
# if BOOST_WORKAROUND (BOOST_MSVC, == 1500)
typename boost::disable_if_c<SeqSize == 0, State>::type::type typename boost::disable_if_c<SeqSize == 0, State>::type::type
>::type> # else
BOOST_FUSION_FOLD_IMPL_ENABLER(State)
# endif
>::type
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
, false
# endif
>
: result_of_it_fold< : result_of_it_fold<
SeqSize-1 SeqSize-1
, typename result_of::next<It>::type , typename result_of::next<It>::type

View File

@ -7,25 +7,49 @@
This is an auto-generated file. Do not edit! This is an auto-generated file. Do not edit!
==============================================================================*/ ==============================================================================*/
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
# define BOOST_FUSION_FOLD_IMPL_ENABLER(T) void
# else
# define BOOST_FUSION_FOLD_IMPL_ENABLER(T) typename T::type
# endif
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
namespace detail namespace detail
{ {
template<int SeqSize, typename It, typename State, typename F, typename = void> template<int SeqSize, typename It, typename State, typename F, typename = void
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
, bool = SeqSize == 0
# endif
>
struct result_of_it_iter_fold struct result_of_it_iter_fold
{}; {};
template<typename It, typename State, typename F> template<typename It, typename State, typename F>
struct result_of_it_iter_fold<0,It,State,F struct result_of_it_iter_fold<0,It,State,F
, typename boost::enable_if_has_type<typename State::type>::type> , typename boost::enable_if_has_type<BOOST_FUSION_FOLD_IMPL_ENABLER(State)>::type
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
, true
# endif
>
{ {
typedef typename State::type type; typedef typename State::type type;
}; };
template<int SeqSize, typename It, typename State, typename F> template<int SeqSize, typename It, typename State, typename F>
struct result_of_it_iter_fold<SeqSize,It,State,F struct result_of_it_iter_fold<SeqSize,It,State,F
, typename boost::enable_if_has_type< , typename boost::enable_if_has_type<
# if BOOST_WORKAROUND (BOOST_MSVC, == 1500)
typename boost::disable_if_c<SeqSize == 0, State>::type::type typename boost::disable_if_c<SeqSize == 0, State>::type::type
>::type> # else
BOOST_FUSION_FOLD_IMPL_ENABLER(State)
# endif
>::type
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
, false
# endif
>
: result_of_it_iter_fold< : result_of_it_iter_fold<
SeqSize-1 SeqSize-1
, typename result_of::next<It>::type , typename result_of::next<It>::type

View File

@ -7,25 +7,49 @@
This is an auto-generated file. Do not edit! This is an auto-generated file. Do not edit!
==============================================================================*/ ==============================================================================*/
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
# define BOOST_FUSION_FOLD_IMPL_ENABLER(T) void
# else
# define BOOST_FUSION_FOLD_IMPL_ENABLER(T) typename T::type
# endif
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
namespace detail namespace detail
{ {
template<int SeqSize, typename It, typename State, typename F, typename = void> template<int SeqSize, typename It, typename State, typename F, typename = void
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
, bool = SeqSize == 0
# endif
>
struct result_of_it_reverse_fold struct result_of_it_reverse_fold
{}; {};
template<typename It, typename State, typename F> template<typename It, typename State, typename F>
struct result_of_it_reverse_fold<0,It,State,F struct result_of_it_reverse_fold<0,It,State,F
, typename boost::enable_if_has_type<typename State::type>::type> , typename boost::enable_if_has_type<BOOST_FUSION_FOLD_IMPL_ENABLER(State)>::type
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
, true
# endif
>
{ {
typedef typename State::type type; typedef typename State::type type;
}; };
template<int SeqSize, typename It, typename State, typename F> template<int SeqSize, typename It, typename State, typename F>
struct result_of_it_reverse_fold<SeqSize,It,State,F struct result_of_it_reverse_fold<SeqSize,It,State,F
, typename boost::enable_if_has_type< , typename boost::enable_if_has_type<
# if BOOST_WORKAROUND (BOOST_MSVC, == 1500)
typename boost::disable_if_c<SeqSize == 0, State>::type::type typename boost::disable_if_c<SeqSize == 0, State>::type::type
>::type> # else
BOOST_FUSION_FOLD_IMPL_ENABLER(State)
# endif
>::type
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
, false
# endif
>
: result_of_it_reverse_fold< : result_of_it_reverse_fold<
SeqSize-1 SeqSize-1
, typename result_of::prior<It>::type , typename result_of::prior<It>::type

View File

@ -7,25 +7,49 @@
This is an auto-generated file. Do not edit! This is an auto-generated file. Do not edit!
==============================================================================*/ ==============================================================================*/
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
# define BOOST_FUSION_FOLD_IMPL_ENABLER(T) void
# else
# define BOOST_FUSION_FOLD_IMPL_ENABLER(T) typename T::type
# endif
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
namespace detail namespace detail
{ {
template<int SeqSize, typename It, typename State, typename F, typename = void> template<int SeqSize, typename It, typename State, typename F, typename = void
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
, bool = SeqSize == 0
# endif
>
struct result_of_it_reverse_iter_fold struct result_of_it_reverse_iter_fold
{}; {};
template<typename It, typename State, typename F> template<typename It, typename State, typename F>
struct result_of_it_reverse_iter_fold<0,It,State,F struct result_of_it_reverse_iter_fold<0,It,State,F
, typename boost::enable_if_has_type<typename State::type>::type> , typename boost::enable_if_has_type<BOOST_FUSION_FOLD_IMPL_ENABLER(State)>::type
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
, true
# endif
>
{ {
typedef typename State::type type; typedef typename State::type type;
}; };
template<int SeqSize, typename It, typename State, typename F> template<int SeqSize, typename It, typename State, typename F>
struct result_of_it_reverse_iter_fold<SeqSize,It,State,F struct result_of_it_reverse_iter_fold<SeqSize,It,State,F
, typename boost::enable_if_has_type< , typename boost::enable_if_has_type<
# if BOOST_WORKAROUND (BOOST_MSVC, == 1500)
typename boost::disable_if_c<SeqSize == 0, State>::type::type typename boost::disable_if_c<SeqSize == 0, State>::type::type
>::type> # else
BOOST_FUSION_FOLD_IMPL_ENABLER(State)
# endif
>::type
# if BOOST_WORKAROUND (BOOST_MSVC, < 1500)
, false
# endif
>
: result_of_it_reverse_iter_fold< : result_of_it_reverse_iter_fold<
SeqSize-1 SeqSize-1
, typename result_of::prior<It>::type , typename result_of::prior<It>::type