On Jun 14, 2006, at 3:58 PM, Steven E. Harris wrote:
Peter Dimov <pdimov@mmltd.net> writes:
One common problem of this kind is
template< class T, class A = std::allocator<T> > class X;
X<int> x;
foo( x ); // searches std
Given that this can be characterized as a problem, what's a "positive" example to illustrate the motivation for this rule? There must be something useful it's meant to enable. Or, rather, I hope there is.
For example the standard might create I/O for pair: template <class T1, class T2> ostream& operator<<(ostream&, pair<T1, T2>); Then you might also want to get more specialized behavior for pair<MyNamespace::MyType, int> (in your own namespace). It would be nice if when pair<MyNamespace::MyType, int> was given to operator<< both namespace std and namespace MyNamespace were searched for viable overloads. -Howard