epoc32/include/stdapis/boost/mpl/aux_/begin_end_impl.hpp
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
     1.1 --- a/epoc32/include/stdapis/boost/mpl/aux_/begin_end_impl.hpp	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/stdapis/boost/mpl/aux_/begin_end_impl.hpp	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,43 +1,100 @@
     1.4  
     1.5 -#ifndef BOOST_MPL_SET_AUX_BEGIN_END_IMPL_HPP_INCLUDED
     1.6 -#define BOOST_MPL_SET_AUX_BEGIN_END_IMPL_HPP_INCLUDED
     1.7 +#ifndef BOOST_MPL_AUX_BEGIN_END_IMPL_HPP_INCLUDED
     1.8 +#define BOOST_MPL_AUX_BEGIN_END_IMPL_HPP_INCLUDED
     1.9  
    1.10 -// Copyright Aleksey Gurtovoy 2003-2004
    1.11 -// Copyright David Abrahams 2003-2004
    1.12 +// Copyright Aleksey Gurtovoy 2000-2004
    1.13  //
    1.14 -// Distributed under the Boost Software License, Version 1.0. 
    1.15 +// Distributed under the Boost Software License, Version 1.0.
    1.16  // (See accompanying file LICENSE_1_0.txt or copy at 
    1.17  // http://www.boost.org/LICENSE_1_0.txt)
    1.18  //
    1.19  // See http://www.boost.org/libs/mpl for documentation.
    1.20  
    1.21 -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/begin_end_impl.hpp,v $
    1.22 -// $Date: 2004/09/02 15:41:02 $
    1.23 -// $Revision: 1.3 $
    1.24 +// $Source: /cvsroot/boost/boost/boost/mpl/aux_/begin_end_impl.hpp,v $
    1.25 +// $Date: 2006/07/22 15:08:37 $
    1.26 +// $Revision: 1.8.14.1 $
    1.27  
    1.28  #include <boost/mpl/begin_end_fwd.hpp>
    1.29 -#include <boost/mpl/set/aux_/iterator.hpp>
    1.30 +#include <boost/mpl/sequence_tag_fwd.hpp>
    1.31 +#include <boost/mpl/void.hpp>
    1.32 +#include <boost/mpl/eval_if.hpp>
    1.33 +#include <boost/mpl/aux_/has_begin.hpp>
    1.34 +#include <boost/mpl/aux_/na.hpp>
    1.35 +#include <boost/mpl/aux_/traits_lambda_spec.hpp>
    1.36 +#include <boost/mpl/aux_/config/eti.hpp>
    1.37  
    1.38  namespace boost { namespace mpl {
    1.39  
    1.40 -template<>
    1.41 -struct begin_impl< aux::set_tag >
    1.42 +namespace aux { 
    1.43 +
    1.44 +template< typename Sequence > 
    1.45 +struct begin_type 
    1.46 +{ 
    1.47 +    typedef typename Sequence::begin type; 
    1.48 +};
    1.49 +template< typename Sequence > 
    1.50 +struct end_type
    1.51 +{ 
    1.52 +    typedef typename Sequence::end type; 
    1.53 +};
    1.54 +
    1.55 +}
    1.56 +
    1.57 +// default implementation; conrete sequences might override it by 
    1.58 +// specializing either the 'begin_impl/end_impl' or the primary 
    1.59 +// 'begin/end' templates
    1.60 +
    1.61 +template< typename Tag >
    1.62 +struct begin_impl
    1.63  {
    1.64 -    template< typename Set > struct apply
    1.65 +    template< typename Sequence > struct apply
    1.66      {
    1.67 -        typedef s_iter<Set,Set> type;
    1.68 +        typedef typename eval_if<aux::has_begin<Sequence, true_>,
    1.69 +                                 aux::begin_type<Sequence>, void_>::type type;
    1.70      };
    1.71  };
    1.72  
    1.73 -template<>
    1.74 -struct end_impl< aux::set_tag >
    1.75 +template< typename Tag >
    1.76 +struct end_impl
    1.77  {
    1.78 -    template< typename Set > struct apply
    1.79 +    template< typename Sequence > struct apply
    1.80      {
    1.81 -        typedef s_iter< Set,set0<> > type;
    1.82 +        typedef typename eval_if<aux::has_begin<Sequence, true_>,
    1.83 +                                 aux::end_type<Sequence>, void_>::type type;
    1.84      };
    1.85  };
    1.86  
    1.87 +// specialize 'begin_trait/end_trait' for two pre-defined tags
    1.88 +
    1.89 +#   define AUX778076_IMPL_SPEC(name, tag, result) \
    1.90 +template<> \
    1.91 +struct name##_impl<tag> \
    1.92 +{ \
    1.93 +    template< typename Sequence > struct apply \
    1.94 +    { \
    1.95 +        typedef result type; \
    1.96 +    }; \
    1.97 +}; \
    1.98 +/**/
    1.99 +
   1.100 +// a sequence with nested 'begin/end' typedefs; just query them
   1.101 +AUX778076_IMPL_SPEC(begin, nested_begin_end_tag, typename Sequence::begin)
   1.102 +AUX778076_IMPL_SPEC(end, nested_begin_end_tag, typename Sequence::end)
   1.103 +
   1.104 +// if a type 'T' does not contain 'begin/end' or 'tag' members 
   1.105 +// and doesn't specialize either 'begin/end' or 'begin_impl/end_impl' 
   1.106 +// templates, then we end up here
   1.107 +AUX778076_IMPL_SPEC(begin, non_sequence_tag, void_)
   1.108 +AUX778076_IMPL_SPEC(end, non_sequence_tag, void_)
   1.109 +AUX778076_IMPL_SPEC(begin, na, void_)
   1.110 +AUX778076_IMPL_SPEC(end, na, void_)
   1.111 +
   1.112 +#   undef AUX778076_IMPL_SPEC
   1.113 +
   1.114 +
   1.115 +BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(1,begin_impl)
   1.116 +BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(1,end_impl)
   1.117 +
   1.118  }}
   1.119  
   1.120 -#endif // BOOST_MPL_SET_AUX_BEGIN_END_IMPL_HPP_INCLUDED
   1.121 +#endif // BOOST_MPL_AUX_BEGIN_END_IMPL_HPP_INCLUDED