• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why does this fail to compile?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does this fail to compile?


  • Subject: Re: Why does this fail to compile?
  • From: "Jason Foreman" <email@hidden>
  • Date: Fri, 16 Nov 2007 09:08:45 -0600

On 11/16/07, Jamie Cho <email@hidden> wrote:
compile the code below, I get the following errors from XCode 3.0:
/Users/jcho/CompilingProblem/Vector.h: In member function 'std::string
jcho::Vector<T>::to_string() const':
/Users/jcho/CompilingProblem/Vector.h:31: error: expected `;' before
'iter'
/Users/jcho/CompilingProblem/Vector.h:32: error: 'iter' was not
declared in this scope

This problem only happens when Vector is a template class. What am I
doing wrong?


Read up on the "typename" keyword. 


                        vector_t::const_iterator iter = _storage.begin();


 
In this case, vector_t::const_iterator is a dependent type, so you should use this:

typename vector_t::const_iterator iter = _storage.begin();


Hope that helps,

Jason


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Why does this fail to compile? (From: Jamie Cho <email@hidden>)

  • Prev by Date: Breakpoints doesn't work
  • Next by Date: Re: Name Quoting Issues & The Ohms Character
  • Previous by thread: Why does this fail to compile?
  • Next by thread: GNU Make project in XCode 3.0?
  • Index(es):
    • Date
    • Thread