The case where I have wished for something like this is only marginally
related to the one described above but in the definition of the partial
specialization below
namespace X { namespace Y {
template <class X, int>
struct foo {
int bar() { return 0; }
};
} }
// Lots of code and then this is in into another file
namespace A { namespace B { namespace C {
// Do something
} // namespace C
} // namespace B
} // namespace A
namespace X { namespace Y {
template <>
int foo<::A::B::C::tag,17>::bar() { return 1; }
} }
namespace A { namespace B { namespace C {
// Do something with ::X::Y::foo::bar
...
it would be very nice to be able to define the partial specialization
of ::X::Y::foo<int,17>::bar() right inside the A::B::C namespace as
follows:
template <>
int ::X::Y::foo<int,17>::bar() { return 1; }
or even as
template <>
int ::namespace X::namespace Y::foo<int,17>::bar() { return 1; }
particularly when I have to do it over and over again intermixed with
other code - getting out of the current namespace and into the one I
need for the specialization and then back to where I need the
specialization gets old rather quickly.
On the other hand I can understand if people balks on how the name
lookup rules should look in this case.
/MF