Thread: Operator overloading for an inner class of a class template causes compilation error

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Maybe

    Code:
    template<typename T>
    std::ostream& A<T>::B::operator << (std::ostream& os, const typename A<T>::B& b) {
        return os<<"an instance of B";
    }
    ?
    Last edited by Elysia; 11-09-2007 at 03:41 PM.

  2. #2
    Registered User
    Join Date
    Nov 2007
    Posts
    3
    Thank you for your answer.
    However it can't help me since the operator must not be a member of the struct B
    (the operator takes ostream as the left operand).

    Alex

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Getting other processes class names
    By Hawkin in forum Windows Programming
    Replies: 3
    Last Post: 03-20-2008, 04:02 PM
  3. How to monitor process creation?
    By markiz in forum Windows Programming
    Replies: 31
    Last Post: 03-17-2008, 02:39 PM
  4. Crazy errors caused by class, never seen before..
    By Shamino in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2007, 11:54 AM
  5. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM