Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2006-05-17 08:01:50


On 05/17/2006 01:10 AM, Joel de Guzman wrote:
> Larry Evans wrote:
[snip]
>>type" in vector's at_impl is done with mpl::at. The
>>similarity between list and vector at_impl would be more
>>apparent if:
[snip suggested changes]
> Looks good to me. Do you have a patch?
Well, I've got a rcsdiff -c between the two versions. The command
was:

rcsdiff -c -r1.1 -r1.2 at_impl.hpp>at_impl.hpp.diff
===================================================================
RCS file: RCS/at_impl.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2

and the resulting diff should be attached. I'm on
linux; so, the diff includes some CRLF char which
you might not like. The 1.1 version is the one from
the zip file mentioned in the original fusion review
post. IOW, it's not from:

   http://spirit.sourceforge.net/dl_more/fusion_v2_review/

but I assume there's no difference between the
original zip and fusion_v2_review files.


*** at_impl.hpp 2006/05/16 16:53:31 1.1
--- at_impl.hpp 2006/05/16 18:26:18 1.2
***************
*** 26,50 ****
          template <>
          struct at_impl<cons_tag>
          {
! template <typename Sequence, typename N>
! struct apply
              {
- typedef typename
- mpl::eval_if<
- is_const<Sequence>
- , add_const<typename Sequence::cdr_type>
- , mpl::identity<typename Sequence::cdr_type>
- >::type
- cdr_type;
-
                  typedef typename
                      mpl::eval_if<
! mpl::bool_<N::value == 0>
                        , mpl::identity<typename Sequence::car_type>
! , apply<cdr_type, mpl::int_<N::value-1> >
! >
! element;
  
                  typedef typename
                      mpl::eval_if<
                          is_const<Sequence>
--- 26,47 ----
          template <>
          struct at_impl<cons_tag>
          {
! template <typename Sequence, int N>
! struct elem_at_c
              {
                  typedef typename
                      mpl::eval_if<
! mpl::bool_<N == 0>
                        , mpl::identity<typename Sequence::car_type>
! , elem_at_c<typename Sequence::cdr_type, N-1>
! >::type
! type;
! };
  
+ template <typename Sequence, typename N>
+ struct apply
+ {
+ typedef elem_at_c<Sequence, N::value> element;
                  typedef typename
                      mpl::eval_if<
                          is_const<Sequence>
***************
*** 52,58 ****
                        , detail::ref_result<element>
>::type
                  type;
!
                  template <typename Cons, int N2>
                  static type
                  call(Cons& s, mpl::int_<N2>)
--- 49,55 ----
                        , detail::ref_result<element>
>::type
                  type;
!
                  template <typename Cons, int N2>
                  static type
                  call(Cons& s, mpl::int_<N2>)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk