CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Oct 2007
    Posts
    34

    [RESOLVED] Enum in template class

    Can anyone help with the cause and resolution to this compile error?

    Here is the code:
    Code:
        template <typename T>
        class BigQueue {
        public:
            enum QueueState {GOOD, BAD, UNKNOWN};
        
        ....
    
        private:
            QueueState getQueueState();
    
        ....
        };
    
    
        template <typename T>
        QueueState BigQueue<T>::getQueueState()
        {
            return m_queueState;
        }
    This is not the complete code. I tried to pull out only the parts that pretain to the compile error. Also, all of this is in the .h file. Using gcc on Linux. If more information is needed please let me know.

    Here is the compile error:
    error: expected constructor, destructor, or type conversion before "BigQueue"

    I read about undeducible context having to do with this compile error but I really did not understand exactly what that means and how to fix it. Something to do with returning the enum type from a function that is part of the template class.

    Will someone please help with what is going on?

    Thanks.
    Last edited by Yadrif; July 16th, 2009 at 10:53 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured