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

Discussion in 'C++' started by Peng Yu, Sep 14, 2008.

  1. Peng Yu

    Peng Yu Guest

    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
    Peng Yu, Sep 14, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. theotyflos
    Replies:
    3
    Views:
    450
    Thomas Matthews
    Feb 19, 2004
  2. Alex Vinokur
    Replies:
    1
    Views:
    358
    mlimber
    Jun 6, 2006
  3. Jeremy
    Replies:
    6
    Views:
    1,256
    Jeremy
    Dec 2, 2010
  4. ThunderMusic
    Replies:
    1
    Views:
    140
    ThunderMusic
    Feb 22, 2007
  5. parmenides
    Replies:
    1
    Views:
    156
    Stefan Ram
    Aug 21, 2013
Loading...

Share This Page