Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Can define a class for namespace A in some other namespace B?

Thread Tools

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

Peng Yu
Posts: n/a

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?

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Transform self-define namespace XML with DOM, can't make value in the result Document abnerliu Software 0 08-04-2011 03:27 PM
How can I define class methods outside of the class? Jeremy Python 6 12-02-2010 06:22 PM
Static function of some class as a friend of other class Alex Vinokur C++ 1 06-06-2006 12:16 PM
About typedef -- define the function pointer or define function model? robin liu C Programming 3 04-21-2006 03:26 PM
How to define a define that defines some defines ? theotyflos C Programming 3 02-19-2004 05:07 PM