
Hi Dave, On Oct 2, 2006, at 4:40 AM, David Abrahams wrote:
Sure. So, leaving aside that I have the syntax and probably a few other things wrong:
template <class T, Sequence<int*> S1, Sequence<T> S2, UnaryFunction<T,int*> F> void transform(S1 const& src, S2& dst, F f)
typedef std::pair<int*,int*> r;
template <Sequence<int> S1> std::pair<int*,int*> f(S1 s) { r ret;
// treat pair<int*,int*> as a sequence of int* concept_map<r, Sequence<int*> > { ... };
transform(s, ret, address()); }
int storage[2]; r input = { storage, storage+2 };
// Treat pair<int*,int*> as a sequence of int concept_map<r, Sequence<int> > { ... };
// OK? r x = f(input);
// which concept does x model?
It's early in the morning, but I'll do my best... In this outer scope, the type 'r' models Sequence<int>, so the call to f type checks. Inside of function f, 'S1' models Sequence<int> and 'r' models Sequence<int*>. The call to transform will not type check because the requirement Sequence<int*> S1 is not satisfied. Cheers, Jeremy __________________________________ Jeremy Siek <siek@cs.colorado.edu> http://www.cs.colorado.edu/~siek/ Visiting Assistant Professor Department of Computer Science University of Colorado at Boulder