Update of /cvsroot/boost/boost/boost/fusion/functional/adapter
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3199/functional/adapter

Added Files:
        fused.hpp fused_function_object.hpp fused_procedure.hpp 
        limits.hpp unfused_generic.hpp unfused_lvalue_args.hpp 
        unfused_rvalue_args.hpp unfused_typed.hpp 
Log Message:
adds functional module


--- NEW FILE: fused.hpp ---
/*=============================================================================
    Copyright (c) 2006-2007 Tobias Schwinger
  
    Use modification and distribution are subject to 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).
==============================================================================*/

#if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_FUSED_HPP_INCLUDED)
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_FUSED_HPP_INCLUDED

#include <boost/type_traits/add_reference.hpp>

#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/functional/invocation/invoke.hpp>

namespace boost { namespace fusion
{
    template <typename Function> class fused;

    //----- ---- --- -- - -  -   -

    template <typename Function>
    class fused
    {
        Function fnc_transformed;

        typedef typename boost::add_reference<Function>::type func_fwd_t;
        typedef typename detail::call_param<Function>::type func_const_fwd_t;

    public:

        inline explicit fused(func_const_fwd_t f = Function())
            : fnc_transformed(f)
        { }

        template <class Seq> 
        inline typename result_of::invoke<Function,Seq const>::type 
        operator()(Seq const & s) const
        {
          return fusion::invoke<func_const_fwd_t>(this->fnc_transformed,s);
        }

        template <class Seq> 
        inline typename result_of::invoke<Function,Seq const>::type 
        operator()(Seq const & s) 
        {
          return fusion::invoke<func_fwd_t>(this->fnc_transformed,s);
        }

        template <class Seq> 
        inline typename result_of::invoke<Function,Seq>::type 
        operator()(Seq & s) const
        {
          return fusion::invoke<func_const_fwd_t>(this->fnc_transformed,s);
        }

        template <class Seq> 
        inline typename result_of::invoke<Function,Seq>::type 
        operator()(Seq & s) 
        {
          return fusion::invoke<func_fwd_t>(this->fnc_transformed,s);
        }

        template <class Seq>
        struct result
            : result_of::invoke<Function,Seq>
        { };
    };

}}

#define BOOST_FUSION_CLASS_TPL_PARAMS typename F
#define  BOOST_FUSION_CLASS_TPL_SPEC fusion::fused<F>
#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>

#endif


--- NEW FILE: fused_function_object.hpp ---
/*=============================================================================
    Copyright (c) 2006-2007 Tobias Schwinger
  
    Use modification and distribution are subject to 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).
==============================================================================*/

#if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_FUSED_FUNCTION_OBJECT_HPP_INCLUDED)
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_FUSED_FUNCTION_OBJECT_HPP_INCLUDED

#include <boost/type_traits/add_reference.hpp>

#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/functional/invocation/invoke_function_object.hpp>

namespace boost { namespace fusion
{
    template <class Function> class fused_function_object;

    //----- ---- --- -- - -  -   -

    template <class Function>
    class fused_function_object
    {
        Function fnc_transformed;

        typedef typename boost::add_reference<Function>::type func_fwd_t;
        typedef typename detail::call_param<Function>::type func_const_fwd_t;

    public:

        inline explicit fused_function_object(func_const_fwd_t f = Function())
            : fnc_transformed(f)
        { }

        template <class Seq> 
        inline typename result_of::invoke_function_object<Function,Seq const
            >::type operator()(Seq const & s) const
        {
          return fusion::invoke_function_object<
              func_const_fwd_t >(this->fnc_transformed,s);
        }

        template <class Seq> 
        inline typename result_of::invoke_function_object<Function,Seq const
            >::type 
        operator()(Seq const & s) 
        {
          return fusion::invoke_function_object<
              func_fwd_t >(this->fnc_transformed,s);
        }

        template <class Seq> 
        inline typename result_of::invoke_function_object<Function,Seq>::type
        operator()(Seq & s) const
        {
          return fusion::invoke_function_object<
              func_const_fwd_t >(this->fnc_transformed,s);
        }

        template <class Seq> 
        inline typename result_of::invoke_function_object<Function,Seq>::type
        operator()(Seq & s) 
        {
          return fusion::invoke_function_object<
              func_fwd_t >(this->fnc_transformed,s);
        }

        template <class Seq>
        struct result
            : result_of::invoke_function_object<Function,Seq>
        { };
    };

}}

#define BOOST_FUSION_CLASS_TPL_PARAMS typename F
#define  BOOST_FUSION_CLASS_TPL_SPEC fusion::fused_function_object<F>
#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>

#endif


--- NEW FILE: fused_procedure.hpp ---
/*=============================================================================
    Copyright (c) 2006-2007 Tobias Schwinger
  
    Use modification and distribution are subject to 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).
==============================================================================*/

#if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_FUSED_PROCEDURE_HPP_INCLUDED)
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_FUSED_PROCEDURE_HPP_INCLUDED

#include <boost/type_traits/add_reference.hpp>

#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/functional/invocation/invoke_procedure.hpp>

namespace boost { namespace fusion
{
    template <typename Function> class fused_procedure;

    //----- ---- --- -- - -  -   -

    template <typename Function>
    class fused_procedure
    {
        Function fnc_transformed;

        typedef typename boost::add_reference<Function>::type func_fwd_t;
        typedef typename detail::call_param<Function>::type func_const_fwd_t;

    public:

        inline explicit fused_procedure(func_const_fwd_t f = Function())
            : fnc_transformed(f)
        { }

        template <class Seq> 
        inline typename result_of::invoke_procedure<Function,Seq const>::type 
        operator()(Seq const & s) const
        {
          return fusion::invoke_procedure<
              func_const_fwd_t >(this->fnc_transformed,s);
        }

        template <class Seq> 
        inline typename result_of::invoke_procedure<Function,Seq const>::type
        operator()(Seq const & s) 
        {
          return fusion::invoke_procedure<
              func_fwd_t >(this->fnc_transformed,s);
        }

        template <class Seq> 
        inline typename result_of::invoke_procedure<Function,Seq>::type 
        operator()(Seq & s) const
        {
          return fusion::invoke_procedure<
              func_const_fwd_t >(this->fnc_transformed,s);
        }

        template <class Seq> 
        inline typename result_of::invoke_procedure<Function,Seq>::type 
        operator()(Seq & s) 
        {
          return fusion::invoke_procedure<
              func_fwd_t >(this->fnc_transformed,s);
        }

        template <class Seq>
        struct result
            : result_of::invoke_procedure<Function,Seq>
        { };

        typedef void result_type;
    };
}}

#endif


--- NEW FILE: limits.hpp ---
/*=============================================================================
    Copyright (c) 2006-2007 Tobias Schwinger
  
    Use modification and distribution are subject to 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).
==============================================================================*/

#if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_LIMITS_HPP_INCLUDED)
#   define BOOST_FUSION_FUNCTIONAL_ADAPTER_LIMITS_HPP_INCLUDED

#   include <boost/fusion/sequence/container/vector/limits.hpp>

#   if !defined(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY)
#       define BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY 6
#   elif BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY > FUSION_MAX_VECTOR_SIZE
#       error "BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY > FUSION_MAX_VECTOR_SIZE"
#   endif
#   if !defined(BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY)
#       define BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY 6
#   elif BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY > FUSION_MAX_VECTOR_SIZE
#       error "BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY > 
FUSION_MAX_VECTOR_SIZE"
#   endif
#   if !defined(BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY)
#       define BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY 6
#   elif BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY > FUSION_MAX_VECTOR_SIZE
#       error "BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY > 
FUSION_MAX_VECTOR_SIZE"
#   endif
#   if !defined(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY)
#       define BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY 6
#   elif BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY > FUSION_MAX_VECTOR_SIZE
#       error "BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY > FUSION_MAX_VECTOR_SIZE"
#   endif

#endif


--- NEW FILE: unfused_generic.hpp ---
/*=============================================================================
    Copyright (c) 2006-2007 Tobias Schwinger
  
    Use modification and distribution are subject to 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).
==============================================================================*/

#if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_GENERIC_HPP_INCLUDED)
#if !defined(BOOST_PP_IS_ITERATING)

#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>

#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>

#include <boost/fusion/sequence/container/vector/vector.hpp>

#include <boost/fusion/functional/adapter/limits.hpp>
#include <boost/fusion/functional/adapter/detail/access.hpp>
#include <boost/fusion/functional/adapter/detail/nullary_call_base.hpp>

namespace boost { namespace fusion
{
    template <class Function> class unfused_generic;

    //----- ---- --- -- - -  -   -

    struct void_;

    template <class Function> class unfused_generic
        : public detail::nullary_call_base<unfused_generic<Function>, Function>
    {
        Function fnc_transformed;

        template <class D, class F, bool E>
        friend struct detail::nullary_call_base;

        typedef detail::nullary_call_base<
            fusion::unfused_generic<Function>, Function > base;

        typedef typename boost::remove_reference<Function>::type function;
        typedef typename detail::call_param<Function>::type func_const_fwd_t;

      public:

        inline explicit unfused_generic(func_const_fwd_t f = Function())
            : fnc_transformed(f)
        { }

        using base::operator();

        template <
            BOOST_PP_ENUM_BINARY_PARAMS(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY,
                typename T, = fusion::void_ BOOST_PP_INTERCEPT),
                class _ = fusion::void_
            >
        struct result;

        template <class _>
        struct result<
            BOOST_PP_ENUM_PARAMS(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY,
                fusion::void_ BOOST_PP_INTERCEPT),_>
            : base::r0
        { };

        #define BOOST_FUSION_CODE(tpl_params,arg_types,params,args)             
\
        template <tpl_params>                                                  \
        inline typename function::template result<                             \
            BOOST_PP_CAT(fusion::vector,N)<arg_types> >::type                  \
        operator()(params) const                                               \
        {                                                                      \
            BOOST_PP_CAT(fusion::vector,N)<arg_types> arg(args);               \
            return this->fnc_transformed(arg);                                 \
        }                                                                      \
        template <tpl_params>                                                  \
        inline typename function::template result<                             \
            BOOST_PP_CAT(fusion::vector,N)<arg_types> >::type                  \
        operator()(params)                                                     \
        {                                                                      \
            BOOST_PP_CAT(fusion::vector,N)<arg_types> arg(args);               \
            return this->fnc_transformed(arg);                                 \
        }

        #define  BOOST_PP_INDIRECT_SELF                                        \
            <boost/fusion/functional/adapter/unfused_generic.hpp>
        #define  BOOST_PP_FILENAME_1                                           \
            <boost/fusion/functional/adapter/detail/pow2_explode.hpp>
        #define  BOOST_PP_ITERATION_LIMITS                                     \
            (1,BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY)
        #define  N BOOST_PP_ITERATION_1
        #include BOOST_PP_ITERATE()
        #undef   N
        #undef BOOST_FUSION_CODE
    };
}}

#define  BOOST_FUSION_CLASS_TPL_PARAMS class F
#define  BOOST_FUSION_CLASS_TPL_SPEC fusion::unfused_generic<F>
#define  BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY
#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>

#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_GENERIC_HPP_INCLUDED
#else // defined(BOOST_PP_IS_ITERATING)
///////////////////////////////////////////////////////////////////////////////
//
//  Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////

#include <boost/fusion/functional/adapter/detail/pt_def.hpp>

#if BOOST_PP_SLOT_1() == 0 
        template <BOOST_PP_ENUM_PARAMS(N,typename T), class _>
        struct result
#if N < BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY
            < BOOST_PP_ENUM_PARAMS(N,T),
            BOOST_PP_ENUM_PARAMS(
                BOOST_PP_SUB(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY,N),
                fusion::void_ BOOST_PP_INTERCEPT), _ >
#endif
            : function::template result< BOOST_PP_CAT(fusion::vector,N)<
                BOOST_PP_ENUM_BINARY_PARAMS(N,typename detail::gref<T,>::type
                    BOOST_PP_INTERCEPT) > >
        { };
#endif

#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1400)) 
        template <BOOST_PP_ENUM_PARAMS(N,typename T)>
        inline typename function::template result<
            BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)> >::type
        operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a)) const
        {
            BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)>
                arg(BOOST_PP_ENUM_PARAMS(N,a));
            return this->fnc_transformed(arg);
        }
        template <BOOST_PP_ENUM_PARAMS(N,typename T)>
        inline typename function::template result<
            BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)> >::type
        operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a))
        {
            BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)>
                arg(BOOST_PP_ENUM_PARAMS(N,a));
            return this->fnc_transformed(arg);
        }
#else
        BOOST_FUSION_CODE(BOOST_PP_ENUM_PARAMS(N,typename T),
            BOOST_PP_ENUM_PARAMS(N,PT), BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a),
            BOOST_PP_ENUM_PARAMS(N,a) )
        // ...generates uglier code but is faster - it caches ENUM_*
#endif

#include <boost/fusion/functional/adapter/detail/pt_undef.hpp>

#endif // defined(BOOST_PP_IS_ITERATING)
#endif


--- NEW FILE: unfused_lvalue_args.hpp ---
/*=============================================================================
    Copyright (c) 2006-2007 Tobias Schwinger
  
    Use modification and distribution are subject to 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).
==============================================================================*/

#if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_LVALUE_ARGS_HPP_INCLUDED)
#if !defined(BOOST_PP_IS_ITERATING)

#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>

#include <boost/type_traits/remove_reference.hpp>

#include <boost/fusion/sequence/container/vector/vector.hpp>

#include <boost/fusion/functional/adapter/limits.hpp>
#include <boost/fusion/functional/adapter/detail/access.hpp>
#include <boost/fusion/functional/adapter/detail/nullary_call_base.hpp>

namespace boost { namespace fusion
{
    template <class Function> class unfused_lvalue_args;

    //----- ---- --- -- - -  -   -

    struct void_;

    template <class Function> class unfused_lvalue_args
        : public detail::nullary_call_base
              <unfused_lvalue_args<Function>, Function>
    {
        Function fnc_transformed;

        template <class D, class F, bool E>
        friend struct detail::nullary_call_base;

        typedef detail::nullary_call_base<
            fusion::unfused_lvalue_args<Function>, Function > base;

        typedef typename boost::remove_reference<Function>::type function;
        typedef typename detail::call_param<Function>::type func_const_fwd_t;

      public:

        inline explicit unfused_lvalue_args(func_const_fwd_t f = function())
            : fnc_transformed(f)
        { }

        using base::operator();

        template <
            BOOST_PP_ENUM_BINARY_PARAMS(
                BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY,
                typename T, = fusion::void_ BOOST_PP_INTERCEPT ), 
            class _ = fusion::void_ >
        struct result;

        template <typename _>
        struct result<BOOST_PP_ENUM_PARAMS(
                BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY,
                fusion::void_ BOOST_PP_INTERCEPT ), _ >
            : base::r0
        { };

        #define  BOOST_PP_FILENAME_1 \
            <boost/fusion/functional/adapter/unfused_lvalue_args.hpp>
        #define  BOOST_PP_ITERATION_LIMITS \
            (1,BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY)
        #include BOOST_PP_ITERATE()
    };
}}

#define  BOOST_FUSION_CLASS_TPL_PARAMS class F
#define  BOOST_FUSION_CLASS_TPL_SPEC fusion::unfused_lvalue_args<F>
#define  BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY
#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>

#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_LVALUE_ARGS_HPP_INCLUDED
#else // defined(BOOST_PP_IS_ITERATING)
////////////////////////////////////////////////////////////////////////////////
//
//  Preprocessor vertical repetition code
//
////////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()

        template <BOOST_PP_ENUM_PARAMS(N,typename T), class _>
        struct result
#if N < BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY
            < BOOST_PP_ENUM_PARAMS(N,T),
            BOOST_PP_ENUM_PARAMS(
                BOOST_PP_SUB(BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY,N),
                fusion::void_ BOOST_PP_INTERCEPT), _ >
#endif
            : function::template result< BOOST_PP_CAT(fusion::vector,N)<
                BOOST_PP_ENUM_BINARY_PARAMS(N,typename detail::mref<T,>::type
                    BOOST_PP_INTERCEPT) > >
        { };

        template <BOOST_PP_ENUM_PARAMS(N,typename T)>
        inline typename function::template result<BOOST_PP_CAT(fusion::vector,N)
            <BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> >::type
        operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const
        {
            BOOST_PP_CAT(fusion::vector,N)<
                  BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT) >
                arg(BOOST_PP_ENUM_PARAMS(N,a));
            return this->fnc_transformed(arg);
        }

        template <BOOST_PP_ENUM_PARAMS(N,typename T)>
        inline typename function::template result<BOOST_PP_CAT(fusion::vector,N)
            <BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> >::type
        operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) 
        {
            BOOST_PP_CAT(fusion::vector,N)<
                  BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT) >
                arg(BOOST_PP_ENUM_PARAMS(N,a));
            return this->fnc_transformed(arg);
        }
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)
#endif


--- NEW FILE: unfused_rvalue_args.hpp ---
/*=============================================================================
    Copyright (c) 2006-2007 Tobias Schwinger
  
    Use modification and distribution are subject to 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).
==============================================================================*/

#if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_RVALUE_ARGS_HPP_INCLUDED)
#if !defined(BOOST_PP_IS_ITERATING)

#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>

#include <boost/type_traits/remove_reference.hpp>

#include <boost/fusion/sequence/container/vector/vector.hpp>

#include <boost/fusion/functional/adapter/limits.hpp>
#include <boost/fusion/functional/adapter/detail/access.hpp>
#include <boost/fusion/functional/adapter/detail/nullary_call_base.hpp>

namespace boost { namespace fusion
{
    template <class Function> class unfused_rvalue_args;

    //----- ---- --- -- - -  -   -

    struct void_;

    template <class Function> class unfused_rvalue_args
        : public detail::nullary_call_base
              <unfused_rvalue_args<Function>, Function>
    {
        Function fnc_transformed;

        template <class D, class F, bool E>
        friend struct detail::nullary_call_base;

        typedef detail::nullary_call_base<
            fusion::unfused_rvalue_args<Function>, Function > base;

        typedef typename boost::remove_reference<Function>::type function;
        typedef typename detail::call_param<Function>::type func_const_fwd_t;

      public:

        inline explicit unfused_rvalue_args(func_const_fwd_t f = function())
            : fnc_transformed(f)
        { }

        using base::operator();

        template <
            BOOST_PP_ENUM_BINARY_PARAMS(
                BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY,
                typename T, = fusion::void_ BOOST_PP_INTERCEPT ),
                class _ = fusion::void_ >
        struct result;

        template <typename _>
        struct result<BOOST_PP_ENUM_PARAMS(
                BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY,
                fusion::void_ BOOST_PP_INTERCEPT),_>
            : base::r0
        { };

        #define  BOOST_PP_FILENAME_1 \
            <boost/fusion/functional/adapter/unfused_rvalue_args.hpp>
        #define  BOOST_PP_ITERATION_LIMITS \
            (1,BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY)
        #include BOOST_PP_ITERATE()
    };
}}

#define  BOOST_FUSION_CLASS_TPL_PARAMS class F
#define  BOOST_FUSION_CLASS_TPL_SPEC fusion::unfused_rvalue_args<F>
#define  BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_RVALUE_ARG_MAX_ARITY
#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>

#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_RVALUE_ARGS_HPP_INCLUDED
#else // defined(BOOST_PP_IS_ITERATING)
////////////////////////////////////////////////////////////////////////////////
//
//  Preprocessor vertical repetition code
//
////////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()

        template <BOOST_PP_ENUM_PARAMS(N,typename T), class _>
        struct result
#if N < BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY
            < BOOST_PP_ENUM_PARAMS(N,T),
            BOOST_PP_ENUM_PARAMS(
                BOOST_PP_SUB(BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY,N),
                fusion::void_ BOOST_PP_INTERCEPT), _ >
#endif
            : function::template result< BOOST_PP_CAT(fusion::vector,N)<
                BOOST_PP_ENUM_BINARY_PARAMS(N,typename detail::cref<T,>::type
                    BOOST_PP_INTERCEPT) > >
        { };

        template <BOOST_PP_ENUM_PARAMS(N,typename T)>
        inline typename function::template result<BOOST_PP_CAT(fusion::vector,N)
            <BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)> >::type
        operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a)) const
        {
            BOOST_PP_CAT(fusion::vector,N)<
                  BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT) >
                arg(BOOST_PP_ENUM_PARAMS(N,a));
            return this->fnc_transformed(arg);
        }

        template <BOOST_PP_ENUM_PARAMS(N,typename T)>
        inline typename function::template result<BOOST_PP_CAT(fusion::vector,N)
            <BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)> >::type
        operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a)) 
        {
            BOOST_PP_CAT(fusion::vector,N)<
                  BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT) >
                arg(BOOST_PP_ENUM_PARAMS(N,a));
            return this->fnc_transformed(arg);
        }

#undef N
#endif // defined(BOOST_PP_IS_ITERATING)
#endif


--- NEW FILE: unfused_typed.hpp ---
/*=============================================================================
    Copyright (c) 2006-2007 Tobias Schwinger
  
    Use modification and distribution are subject to 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).
==============================================================================*/

#if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_TYPED_HPP_INCLUDED)
#if !defined(BOOST_PP_IS_ITERATING)

#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>

#include <boost/type_traits/remove_reference.hpp>

#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/sequence/container/vector/vector.hpp>
#include <boost/fusion/sequence/conversion/as_vector.hpp>
#include <boost/fusion/algorithm/transformation/pop_back.hpp>

#include <boost/fusion/functional/adapter/limits.hpp>
#include <boost/fusion/functional/adapter/detail/has_type.hpp>
#include <boost/fusion/functional/adapter/detail/nullary_call_base.hpp>

namespace boost { namespace fusion
{

    template <class Function, class Sequence> class unfused_typed;

    //----- ---- --- -- - -  -   -

    namespace detail
    {
        template <class Derived, class Function, class Sequence,
            long Arity, bool EnableCallOp>
        struct unfused_typed_impl;

        template <class Derived, class Function, class Sequence,
            class NextSeq = typename result_of::pop_back<Sequence>::type >
        struct unfused_typed_next_base 
        {
            // type of the next base class
            typedef unfused_typed_impl
                < Derived, Function, NextSeq, result_of::size<NextSeq>::value,
                  has_type< typename Function::template result< 
                      typename result_of::as_vector<NextSeq>::type > >::value
                >
            type; 
        };

        template <class Derived, class Function, class Sequence, long Arity>
        struct unfused_typed_impl<Derived,Function,Sequence,Arity,false>
            : unfused_typed_next_base<Derived,Function,Sequence>::type
        { };

        template <class Derived, class Function, class Sequence>
        struct unfused_typed_impl<Derived,Function,Sequence,0,false>
            : nullary_call_base<Derived,Function,false>
        { };

        template <class Derived, class Function, class Sequence>
        struct unfused_typed_impl<Derived,Function,Sequence,0,true>
            : nullary_call_base<Derived,Function,true>
        { };

    }

    template <class Function, class Sequence>
    class unfused_typed
        : public detail::unfused_typed_next_base
          < unfused_typed<Function,Sequence>,
            typename remove_reference<Function>::type, Sequence, Sequence
          >::type
    {
        Function fnc_transformed;

        template <class D, class F, class S, long A, bool EO>
        friend struct detail::unfused_typed_impl;

        template <class D, class F, bool E>
        friend struct detail::nullary_call_base;

        typedef typename boost::remove_reference<Function>::type function;
        typedef typename detail::call_param<Function>::type func_const_fwd_t;

        typedef typename detail::unfused_typed_next_base<unfused_typed<
            Function,Sequence>,function,Sequence,Sequence>::type base;

    public:

        inline explicit unfused_typed(func_const_fwd_t f = Function())
            : fnc_transformed(f)
        { }

        template <
            BOOST_PP_ENUM_BINARY_PARAMS(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY,
                typename T, = fusion::void_ BOOST_PP_INTERCEPT),
                class _ = fusion::void_
            >
        struct result;

        template <typename _>
        struct result<
            BOOST_PP_ENUM_PARAMS(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY,
                fusion::void_ BOOST_PP_INTERCEPT),_>
            : base::r0
        { };
    }; 

    #define  BOOST_PP_FILENAME_1 
<boost/fusion/functional/adapter/unfused_typed.hpp>
    #define  BOOST_PP_ITERATION_LIMITS (1,BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY)
    #include BOOST_PP_ITERATE() 

}}

#define  BOOST_FUSION_CLASS_TPL_PARAMS class F, class S
#define  BOOST_FUSION_CLASS_TPL_SPEC fusion::unfused_typed<F,S>
#define  BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY
#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>

#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_TYPED_HPP_INCLUDED
#else // defined(BOOST_PP_IS_ITERATING)
///////////////////////////////////////////////////////////////////////////////
//
//  Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()

    namespace detail
    {

        template <class Derived, class Function, class Sequence>
        struct unfused_typed_impl<Derived,Function,Sequence,N,true>
            : unfused_typed_next_base<Derived,Function,Sequence>::type
        {
        private:
            typedef typename unfused_typed_next_base<
                Derived,Function,Sequence>::type base;

            // Notes: 
            // - conversion to fusion::vector might not be perfect (there is 
            //   currently no "inrinsic converting ctor" that would allow us
            //   to let the user choose the sequence implementation)
            // - value_at_c (instead of iteration) is OK because of conversion 
            //   to fusion::vector - we would need iteration for arbitrary 
            //   sequences
            typedef typename result_of::as_vector<Sequence>::type arg_vector_t;
        public:

            using base::operator();

            typedef typename Function::
                template result<arg_vector_t> BOOST_PP_CAT(r,N);

#define M(z,i,s)                                                                
\
    typename call_param<typename result_of::value_at_c<s,i>::type>::type a##i

            inline typename Function::template result<arg_vector_t>::type 
            operator()(BOOST_PP_ENUM(N,M,arg_vector_t)) const
            {
                arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a));
                return static_cast<Derived const *>(this)->fnc_transformed(arg);
            }

            inline typename Function::template result<arg_vector_t>::type 
            operator()(BOOST_PP_ENUM(N,M,arg_vector_t)) 
            {
                arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a));
                return static_cast<Derived *>(this)->fnc_transformed(arg);
            }

#undef M
        };

    } // namespace detail

    template <class Function, class Sequence> 
        template <BOOST_PP_ENUM_PARAMS(N,typename T), class _>
    struct unfused_typed<Function,Sequence>::result
#if N < BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY
            < BOOST_PP_ENUM_PARAMS(N,T),
            BOOST_PP_ENUM_PARAMS(
                BOOST_PP_SUB(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY,N),
                fusion::void_ BOOST_PP_INTERCEPT), _ >
#endif
        : BOOST_PP_CAT(base::r,N)
    { };

#undef N
#endif // defined(BOOST_PP_IS_ITERATING)
#endif



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to