
Jeremy Siek <jeremy.siek@gmail.com> writes:
With scoped maps, you can have different concept maps in scope in different parts of your code.
So if you're about to call an algorithm, and you want pair<int*,int*> to be treated a something with just 2 elements, you would import the concept map from fusion.
Later on, in a different scope, if you want pair<int*,int*> to be treated as something with second-first elements, then you'd import the concept map from the range library.
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) { ... } struct address { template <class T> T* operator()(T& x) { return &x; } }; 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? -- Dave Abrahams Boost Consulting www.boost-consulting.com