Changeset 54686


Ignore:
Timestamp:
Jul 5, 2009, 9:22:39 PM (9 years ago)
Author:
Christopher Schmidt
Message:

cleanup (3)

Location:
sandbox/SOC/2009/fusion
Files:
5 added
16 edited

Legend:

Unmodified
Added
Removed
  • sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/fold.hpp

    r54672 r54686  
    1818#include <boost/fusion/iterator/next.hpp>
    1919#include <boost/fusion/iterator/distance.hpp>
     20#include <boost/fusion/support/result_of.hpp>
    2021
    2122#include <boost/mpl/bool.hpp>
     
    3536        template <typename It, typename State, typename F>
    3637        struct fold_apply
    37         {
    38             typedef typename identity<F>::type identity_F;
    39 
    40             typedef typename
    41                 identity_F::template result<
    42                     identity_F(
    43                         typename result_of::deref<It>::type
    44                       , State
    45                     )
    46                 >::type
    47             type;
    48         };
     38          : support::result_of<
     39                F(
     40                    typename result_of::deref<It>::type
     41                  , State
     42                )
     43            >
     44        {};
    4945
    5046        template <typename First, typename Last, typename State, typename F>
  • sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/for_each.hpp

    r54672 r54686  
    5454                fusion::begin(seq)
    5555              , f
    56               , result_of::empty<Seq>::type());
     56              , typename result_of::empty<Seq>::type());
    5757    }
    5858
  • sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/any.hpp

    r54548 r54686  
    77==============================================================================*/
    88
    9 #ifndef BOOST_FUSION_ALGORITHM_QUERY_DETAIL_ALL_HPP
    10 #define BOOST_FUSION_ALGORITHM_QUERY_DETAIL_ALL_HPP
     9#ifndef BOOST_FUSION_ALGORITHM_QUERY_DETAIL_ANY_HPP
     10#define BOOST_FUSION_ALGORITHM_QUERY_DETAIL_ANY_HPP
    1111
    1212#include <boost/fusion/sequence/intrinsic/empty.hpp>
  • sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/replace_if.hpp

    r54672 r54686  
    88#ifndef BOOST_FUSION_ALGORITHM_TRANSFORMATION_DETAIL_REPLACE_IF_HPP
    99#define BOOST_FUSION_ALGORITHM_TRANSFORMATION_DETAIL_REPLACE_IF_HPP
     10
     11#include <boost/fusion/support/result_of.hpp>
    1012
    1113#include <boost/mpl/if.hpp>
     
    4446    };
    4547
     48    //TODO !!!
    4649    template <typename F, typename NewValue>
    4750    struct replacer_if
    4851    {
    49         replacer_if(replacer_if&& replacer_if)
    50           : f(replacer_if.f)
    51           , new_value(replacer_if.new_value)
     52        replacer_if(BOOST_FUSION_R_ELSE_CLREF(replacer_if) replacer)
     53          : f(BOOST_FUSION_FORWARD(
     54                  BOOST_FUSION_R_ELSE_CLREF(replacer_if),replacer).f)
     55          , new_value(BOOST_FUSION_FORWARD(
     56                  BOOST_FUSION_R_ELSE_CLREF(replacer_if),replacer).new_value)
    5257        {}
    5358
    54         template<typename F_, typename NewValue_>
    55         replacer_if(BOOST_FUSION_R_ELSE_LREF(F_) f,
    56                 BOOST_FUSION_R_ELSE_LREF(NewValue_) new_value)
    57           : f(f)
    58           , new_value(new_value)
     59        template<typename OtherF, typename OtherNewValue>
     60        replacer_if(
     61                BOOST_FUSION_R_ELSE_LREF(OtherF) other_f,
     62                BOOST_FUSION_R_ELSE_LREF(OtherNewValue) other_new_value)
     63          : f(BOOST_FUSION_FORWARD(OtherF,other_f))
     64          , new_value(BOOST_FUSION_FORWARD(OtherNewValue,other_new_value))
    5965        {}
    6066
     
    7783        };
    7884
    79         //TODO cschmidt: template result in f?
    8085        template <typename U>
    8186        typename result<replacer_if(U)>::type
  • sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/replace_if.hpp

    r54672 r54686  
    2525        {
    2626            typedef
     27                detail::replacer_if<
     28                    typename detail::as_fusion_element<F>::type
     29                  , typename detail::as_fusion_element<T>::type
     30                >
     31            replacer;
     32
     33            typedef
    2734                transform_view<
    2835                //TODO ?!
     
    3340                        >::type
    3441                    >::type
    35                   , detail::replacer_if<
    36                         typename detail::as_fusion_element<F>::type
    37                       , typename detail::as_fusion_element<T>::type
    38                     >
     42                  , replacer
    3943                >
    4044            type;
     
    5761              , BOOST_FUSION_R_ELSE_LREF(F)
    5862              , BOOST_FUSION_R_ELSE_LREF(NewValue)
    59             >::type
    60         type;
     63            >
     64        result;
    6165
    62         typedef
    63             detail::replacer_if<
    64                 typename detail::as_fusion_element<
    65                     BOOST_FUSION_R_ELSE_LREF(F)
    66                 >::type
    67               , typename detail::as_fusion_element<
    68                     BOOST_FUSION_R_ELSE_LREF(NewValue)
    69                 >::type
    70             >
    71         replacer;
    72 
    73         return type(BOOST_FUSION_FORWARD(Seq,seq),
    74                 replacer(BOOST_FUSION_FORWARD(F,pred),
     66        return typename result::type(BOOST_FUSION_FORWARD(Seq,seq),
     67                typename result::replacer(BOOST_FUSION_FORWARD(F,pred),
    7568                        BOOST_FUSION_FORWARD(NewValue,new_value)));
    7669    }
  • sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/zip.hpp

    r54655 r54686  
    1010#define BOOST_FUSION_ALGORITHM_TRANSFORMATION_ZIP_HPP
    1111
    12 #include <boost/fusion/view/zip_view.hpp>
    13 #include <boost/fusion/adapted/mpl.hpp>
    14 #include <boost/fusion/container/vector.hpp>
    15 #include <boost/fusion/container/vector/convert.hpp>
    16 #include <boost/preprocessor/repetition/enum.hpp>
    17 #include <boost/preprocessor/repetition/enum_params.hpp>
    18 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
    19 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
    20 #include <boost/preprocessor/arithmetic/inc.hpp>
    21 #include <boost/preprocessor/iteration/iterate.hpp>
    22 #include <boost/mpl/vector.hpp>
    23 #include <boost/mpl/transform.hpp>
    24 #include <boost/mpl/placeholders.hpp>
    25 
    26 #if !defined(FUSION_MAX_ZIP_SEQUENCES)
    27 #define FUSION_MAX_ZIP_SEQUENCES 10
     12#if defined(BOOST_NO_VARIADIC_TEMPLATES) || !defined(BOOST_FUSION_CPP0X_NO_DEPRECEATED)
     13#   ifndef FUSION_MAX_ZIP_SEQUENCES
     14#       define FUSION_MAX_ZIP_SEQUENCES 10
     15#   endif
    2816#endif
    2917
    30 namespace boost { namespace fusion {
    31 
    32     struct void_;
    33    
    34     namespace result_of
    35     {
    36         template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PP_INC(FUSION_MAX_ZIP_SEQUENCES), typename T, fusion::void_)>
    37         struct zip;
    38     }
    39 
    40 #define BOOST_PP_FILENAME_1 \
    41     <boost/fusion/algorithm/transformation/zip.hpp>
    42 #define BOOST_PP_ITERATION_LIMITS (2, FUSION_MAX_ZIP_SEQUENCES)
    43 #include BOOST_PP_ITERATE()
    44 
    45 }}
     18#ifdef BOOST_NO_VARIADIC_TEMPLATES
     19#   include <boost/fusion/algorithm/transformation/detail/pp/zip.hpp>
     20#else
     21#   include <boost/fusion/algorithm/transformation/detail/variadic_templates/zip.hpp>
     22#endif
    4623
    4724#endif
    48 
    49 #else
    50 
    51 #define ZIP_ITERATION BOOST_PP_ITERATION()
    52 
    53     namespace result_of
    54     {
    55         template< BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, typename T) >
    56 #if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
    57         #define TEXT(z, n, text) , text
    58         struct zip< BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, T) BOOST_PP_REPEAT_FROM_TO(BOOST_PP_DEC(ZIP_ITERATION), FUSION_MAX_ZIP_SEQUENCES, TEXT, void_) >
    59         #undef TEXT
    60 #else
    61         struct zip< BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, T) >
    62 #endif
    63         {
    64             typedef mpl::vector< BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, T) > sequences;
    65             typedef typename mpl::transform<sequences, detail::add_lref<mpl::_> >::type ref_params;
    66             typedef zip_view<typename result_of::as_vector<ref_params>::type> type;
    67         };
    68     }
    69 
    70 #define FUSION_REF_PARAM(z, n, data) const T ## n&
    71 
    72     template<BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, typename T)>
    73     inline typename result_of::zip<BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, const T)>::type
    74     zip(BOOST_PP_ENUM_BINARY_PARAMS(ZIP_ITERATION, T, const& t))
    75     {
    76         fusion::vector<BOOST_PP_ENUM(ZIP_ITERATION, FUSION_REF_PARAM, _)> seqs(
    77             BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, t));
    78         return typename result_of::zip<BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, const T)>::type(
    79             seqs);
    80     }
    81 
    82 #undef FUSION_REF_PARAM
    83 #undef ZIP_ITERATION
    84 
    85 #endif
  • sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/variadic_templates/vector_impl.hpp

    r54672 r54686  
    150150
    151151        vector()
    152         {
    153         }
     152        {}
    154153
    155154#define VECTOR_CTOR(COMBINATION)\
     
    169168                   is_sequence_assign<SeqAssign> >::type* =NULL)
    170169          : base(detail::assign_by_deref(),fusion::begin(seq.get()))
    171         {
    172         }
     170        {}
    173171
    174172        /*
     
    178176          : base(detail::assign_by_deref(),
    179177                 fusion::begin(BOOST_FUSION_FORWARD(Seq,seq.seq)))
    180         {
    181         }
     178        {}
    182179        */
    183180
     
    187184          : base(assign_directly(),others...)
    188185          , _element(head)
    189         {
    190         }
     186        {}
    191187#else
    192188        template<typename... OtherElements>
     
    194190          : base(detail::assign_directly(),
    195191                 std::forward<OtherElements>(other_elements)...)
    196         {
    197         }
     192        {}
    198193#endif
    199194
  • sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/variadic_templates/vector_n.hpp

    r54672 r54686  
    1212#endif
    1313struct BOOST_PP_CAT(vector, N)
    14     : vector<BOOST_PP_ENUM_PARAMS(N, T)>
     14  : vector<BOOST_PP_ENUM_PARAMS(N, T)>
    1515{
    1616private:
     
    1919public:
    2020    BOOST_PP_CAT(vector, N)()
    21     {
    22     }
     21    {}
     22
     23#define VECTOR_CTOR(COMBINATION)\
     24    BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N) COMBINATION vec)\
     25      : base(sequence_assign(\
     26            BOOST_FUSION_FORWARD(BOOST_PP_CAT(vector, N) COMBINATION,vec)))\
     27    {}
     28
     29    BOOST_FUSION_ALL_CV_REF_COMBINATIONS(VECTOR_CTOR)
     30
     31#undef VECTOR_CTOR
    2332
    2433    template<typename Arg>
    2534    BOOST_PP_CAT(vector, N)(BOOST_FUSION_R_ELSE_CLREF(Arg) arg)
    26         : base(BOOST_FUSION_FORWARD(Arg,arg))
    27     {
    28     }
     35      : base(BOOST_FUSION_FORWARD(Arg,arg))
     36    {}
    2937
    3038#if N > 1
    3139#   ifdef BOOST_NO_RVALUE_REFERENCES
    32     BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(
    33             N, typename detail::call_param<T, >::type _))
    34         : base(BOOST_PP_ENUM_PARAMS(N, _))
    35     {
    36     }
     40    BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, const T, & a))
     41      : base(BOOST_PP_ENUM_PARAMS(N, a))
     42    {}
    3743#   else
    3844#       define FORWARD_ARGUMENT(Z, INDEX, _) std::forward<\
     
    4147    template <BOOST_PP_ENUM_PARAMS(N, typename OtherT)>
    4248    BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, OtherT,&& other))
    43         : base(BOOST_PP_ENUM(N, FORWARD_ARGUMENT, _))
    44     {
    45     }
     49      : base(BOOST_PP_ENUM(N, FORWARD_ARGUMENT, _))
     50    {}
    4651
    4752#       undef FORWARD_ARGUMENT
  • sandbox/SOC/2009/fusion/boost/fusion/sequence/intrinsic/swap.hpp

    r54672 r54686  
    2626        struct swap
    2727        {
    28             template<typename Elem>
    29             struct result
    30             {
    31                 typedef void type;
    32             };
     28            typedef void result_type;
    3329
    3430            template<typename Elem>
  • sandbox/SOC/2009/fusion/boost/fusion/support/tag_of.hpp

    r54548 r54686  
    1515#include <boost/mpl/eval_if.hpp>
    1616#include <boost/mpl/if.hpp>
     17#include <boost/mpl/has_xxx.hpp>
    1718
    1819namespace boost { namespace fusion
  • sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/apply_transform_result.hpp

    r54548 r54686  
    1010#define BOOST_FUSION_VIEW_TRANSFORM_VIEW_DETAIL_APPLY_TRANSFORM_RESULT_HPP
    1111
    12 #include <boost/utility/result_of.hpp>
     12#include <boost/fusion/support/result_of.hpp>
    1313
    1414namespace boost { namespace fusion
     
    2121        struct apply_transform_result
    2222        {
    23             //TODO cschmidt: !!!
    2423            template <typename T0, typename T1 = void_>
    2524            struct apply
    26               : //boost::result_of<F(T0, T1)>
    27                 detail::remove_reference<F>::type::template result<
    28                     typename detail::identity<F>::type(T0, T1)>
     25              : support::result_of<F(T0, T1)>
    2926            {};
    3027
    3128            template <typename T0>
    3229            struct apply<T0, void_>
    33               : //boost::result_of<F(T0)>
    34                 detail::remove_reference<F>::type::template result<
    35                     typename detail::identity<F>::type(T0)>
     30              : support::result_of<F(T0)>
    3631            {};
    3732        };
  • sandbox/SOC/2009/fusion/boost/fusion/view/zip_view/zip_view.hpp

    r54655 r54686  
    137137        zip_view(zip_view<OtherSeqs> COMBINATION other_view)\
    138138          : seqs(sequence_assign(BOOST_FUSION_FORWARD(\
    139                 zip_view<OtherSeqs> COMBINATION,other_view).seq))\
     139                zip_view<OtherSeqs> COMBINATION,other_view).seqs))\
    140140        {}
    141141
  • sandbox/SOC/2009/fusion/libs/fusion/example/test/main.cpp

    r54655 r54686  
    1010#include <boost/fusion/sequence.hpp>
    1111#include <boost/fusion/iterator.hpp>
    12 //#include <boost/fusion/algorithm.hpp>
     12#include <boost/fusion/algorithm.hpp>
    1313#include <boost/fusion/container.hpp>
    1414#include <boost/fusion/view.hpp>
  • sandbox/SOC/2009/fusion/libs/fusion/test/Jamfile

    r54672 r54686  
    2727    [ run algorithm/insert_range.cpp :  :  :  : ]
    2828    [ run algorithm/insert.cpp :  :  :  : ]
    29 #   [ run algorithm/join.cpp :  :  :  : ]
     29    [ run algorithm/join.cpp :  :  :  : ]
    3030    [ run algorithm/none.cpp :  :  :  : ]
    3131    [ run algorithm/pop_back.cpp :  :  :  : ]
     
    3939    [ run algorithm/reverse.cpp :  :  :  : ]
    4040    [ run algorithm/transform.cpp :  :  :  : ]
    41 #   [ run algorithm/zip_ignore.cpp : : : : ]
    42 #   [ run algorithm/zip.cpp : : : : ]
    43 #   [ run algorithm/zip2.cpp : : : : ]
     41    [ run algorithm/zip_ignore.cpp : : : : ]
     42    [ run algorithm/zip.cpp : : : : ]
     43    [ run algorithm/zip2.cpp : : : : ]
    4444
    4545#   [ run sequence/adapt_struct.cpp : : : : ]
  • sandbox/SOC/2009/fusion/libs/fusion/test/algorithm/fold.cpp

    r54548 r54686  
    3838    struct result<add_ints_only(T,State)>
    3939    {
    40         //TODO !!!
    4140        typedef typename boost::fusion::detail::identity<State>::type type;
     41        //TODO cschmidt: remove_reference does not support rvalue refs yet,
     42        //therefore we use the internal function of fusion!
    4243        //typedef typename boost::remove_const<
    4344        //    typename boost::remove_reference<State>::type>::type type;
     
    9495struct appender
    9596{
    96     //TODO
    97     //typedef std::string result_type;
    98 
    99     template<typename>
    100     struct result
    101     {
    102         typedef std::string type;
    103     };
     97    typedef std::string result_type;
    10498
    10599    std::string operator()(char c, std::string const& str) const
     
    184178    {
    185179        vector<int, int> vec(1,2);
    186         //TODO!!!
    187         //BOOST_TEST(fusion::fold(vec, 0, add) == 3);
     180        BOOST_TEST(fusion::fold(vec, 0, add) == 3);
    188181    }
    189182
     
    228221    {
    229222        vector<int, int> vec(1,2);
    230         //TODO!!!
    231         //BOOST_TEST(fusion::accumulate(vec, 0, add) == 3);
     223        BOOST_TEST(fusion::accumulate(vec, 0, add) == 3);
    232224    }
    233225
  • sandbox/SOC/2009/fusion/libs/fusion/test/sequence/cons.cpp

    r54548 r54686  
    1515#include <boost/fusion/sequence/comparison/equal_to.hpp>
    1616#include <boost/lambda/lambda.hpp>
    17 //TODO cschmidt: !!!!
    18 //#include <boost/fusion/algorithm/iteration/for_each.hpp>
    19 //#include <boost/fusion/algorithm/transformation/filter_if.hpp>
     17#include <boost/fusion/algorithm/iteration/for_each.hpp>
     18#include <boost/fusion/algorithm/transformation/filter_if.hpp>
    2019#include <boost/fusion/sequence/io/out.hpp>
    2120
     
    4039            make_cons(1, make_cons(hello));
    4140
    42         //cschmidt: boost::fusion::next collides with std::next on
    43         //gcc <= 4.4 due to broken SFINAE support!
    44 
    4541        BOOST_TEST((*begin(ns) == 1));
    4642        BOOST_TEST((*boost::fusion::next(begin(ns)) == hello));
     
    5248        BOOST_TEST((*boost::fusion::next(begin(ns)) == hello + ' '));
    5349
    54         //for_each(ns, boost::lambda::_1 += ' ');
     50        for_each(ns, boost::lambda::_1 += ' ');
    5551
    56         //BOOST_TEST((*begin(ns) == 2 + ' '));
    57         //BOOST_TEST((*boost::fusion::next(begin(ns)) == hello + ' ' + ' '));
     52        BOOST_TEST((*begin(ns) == 2 + ' '));
     53        BOOST_TEST((*boost::fusion::next(begin(ns)) == hello + ' ' + ' '));
    5854    }
    5955
     
    7571
    7672        BOOST_TEST((t == nf));
    77         //BOOST_TEST((vector<int>(1) == filter_if<is_same<boost::mpl::_, int> >(nf)));
     73        BOOST_TEST((vector<int>(1) == filter_if<is_same<boost::mpl::_, int> >(nf)));
    7874
    7975        std::cout << nf << std::endl;
    80         //std::cout << filter_if<is_same<boost::mpl::_, int> >(nf) << std::endl;
     76        std::cout << filter_if<is_same<boost::mpl::_, int> >(nf) << std::endl;
    8177    }
    8278
Note: See TracChangeset for help on using the changeset viewer.