
Jonathan Turkanis wrote:
"David B. Held" <dheld@codelogicconsulting.com> wrote in message news:cckeh3$fd0$1@sea.gmane.org...
[...] I 'm not sure I see the syntax problem; if you mean that it's more cumbersome to use a metafunction, I agree.
The user would have to write: sp<p1, p2>::nested<t>::type p; instead of: sp<p1, p2>::nested<t> p;
[...] Then specializing less< ... > for sp_nested wouldn't affect the implementation of less<nested>.
Ah, back to square one.
[...] I don't see the distinction between
template <class P1, class P2, typename T> struct less<sp<P1, P2>::nested<T> > : binary_function<...> { bool operator()(...); };
and
template <class P1, class P2, typename T> struct less<sp_nested<P1, P2, T> > : binary_function<...> { bool operator()(...); };
with respect to exposing implementation details.
The difference is that the component is called sp<>::nested<>. It's not called sp_nested<>, because they might want to typedef sp<> and instantiate the nested class over various types. By also exposing sp_nested<>, I'm asking them to call it by two different names depending on usage. It isn't totally evil, but it's less pleasant: typedef sp<p1, p2> my_sp; my_sp::nested<foo> p; my_sp::nested<bar> q; less<my_sp::nested<foo> > comp; vs.: less<sp_nested<p1, p2, foo> > comp; Somewhat defeats the point of the nice typedef. Dave