CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2004
    Posts
    5

    Template Problem

    Hi,

    The following code gives an error:

    Code:
    #include<vector>
    
    template <class range_type, class T>
    class range_vector
    {
    
    public:
    
      typedef std::vector<T>::iterator iterator;
    
    protected:
      std::vector<T> v;
    
      range_type range_start;
    
    };
    The problem seems to be with the typedef. Why is this not allowed?

    Thanks!

  2. #2
    Join Date
    Aug 2007
    Location
    Birmingham, UK
    Posts
    360

    Re: Template Problem

    Could you please also post the error that you are getting? It usually helps to know what the exact error is...

  3. #3
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588

    Re: Template Problem

    typedef typename std::vector<T>::iterator iterator;
    Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
    Supports C++ and VB out of the box, but can be configured for other languages.

  4. #4
    Join Date
    Oct 2004
    Posts
    5

    Re: Template Problem

    Thanks Yves, that solved it!

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