Can define a class for namespace A in some other namespace B?

P

Peng Yu

Hi,

Suppose I have two namespaces A and B, I'm wondering if I can define a
class in B for A. The question is relevant when I want to specialize
some classes that have been defined in the std:: namespace. For
example, I have the following code

namespace my {
....
some code // it needs the specialized version of
std::less<std::complex<T> >
....
}


If I specialize std::less<std::complex<T> > in std::, it will be
effective for any namespace. However, I only want it be effective for
namespace my. I'm wondering if it is possible?

Thanks,
Peng
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,222
Latest member
patricajohnson51

Latest Threads

Top