Boost logo

Boost Users :

Subject: Re: [Boost-users] Placeholders and iterator arithmetic in MPL
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-08-18 11:23:14


AMDG

Rob Platt wrote:
> I can successfully instantiate this with, for example,
> vector_c<int,1,2,3,4>. But when I do iterator arithmetic (e.g. prior,
> next or begin) I run into trouble:
>
> struct fails
> {
> typedef typename reverse_iter_fold<
> T,
> vector_c<long>,
> push_front<_1,
> deref< next<_2> >
> > >::type type;
> };
>
> -- error messages about arg 3 - I suspect that prior is being applied
> to the placeholder arg type itself, not to the iterator. I'm wondering
> if I should be using lambda/apply, but I've tried that without
> success. What's a would-be template metaprogrammer to do?
>

After I included all the right headers, it compiled for me.
The only problem is that you're dereferencing past the
end of the sequence.

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net