
Thanks for the help, David. On 03/01/2005 08:25 AM, David Abrahams wrote: [snip]
Of course that is way too general. Not every template that might match is meant to be a sequence.
OK, but I just want it to work with my fold<...>::type, and making it as general as possible seemed the fasted way to just get a compile to work.
(Also: do you really mean your sequence iterators to be the same type as the sequence itself?)
It doesn't really matter to me as long as I get a clean compile and some result from deref that I can use. If the deref<...>::type is inherit2<Left,Right>, then I can always get the Left or Right parts with another template specialization.
template < template<typename,typename>class ForwardOpTmpl , typename LeftArg , typename RightArg
struct next < ForwardOpTmpl<LeftArg,RightArg> > { typedef RightArg type; }; //}--------- cut-here -------- But intel-linux said next was ambiguous.
As above, too general, but I'm curious anyway: ambiguous with what? A single declaration can't be ambiguous with itself.
I was unclear. The error message was about next: fold_sequence_test.cpp(98): error: "next" is ambiguous typedef next<iter0>::type iter1; ^ See the http://boost-sandbox.sourceforge.net/vault/ in cppljevans/mpl/fold_sequence.zip. The compiler error messages included in this zip only include the 1st error message. The above can be seen by simply mv'ing the nearby #if 0 down past the above statement and compiling.
Also, the above code assumes the last arg to fold was:
ForwardOpTmpl<arg<2>,arg<1> >
No it doesn't. The last arg to fold has nothing to do with it. It might have been a metafunction class. In fact, fold has nothing to do with it.
Well, I've got to know the place_holder arg order in order to know whether next should return the Left or right part of my_inherit<L,R>. [snip]
!? *More* general? That's definitely going down the wrong road.
Yes, but for right now, I just want a compile the works on the simplest type of Sequence arg to fold. [snip]
template <class Left, class Right> struct next<my_inherit<Left,Right> > { // ... whatever };
would be more appropriate.
The fold_sequence_test.zip referred to above does this, but with inherit2 instead of my_inherit; yet, it still get's a compile error, as shown by the fold_sequence_test.intel within the zip.