Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Doesn't Compile...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 45334 of 47977
Post > Topic >>

Doesn't Compile, Why?

by liam_herron <liam_herron@[EMAIL PROTECTED] > Apr 22, 2008 at 12:55 PM

Any idea why the following code doesn't compile?



#include <iostream>
#include <vector>

class  A
{
public:

   template<typename T>
   void f( const std::vector<T>& v)
   {
      std::vector<T>::const_iterator it = v.begin();
      for (, it != v.end(); ++it)
      {
         std::cout << *it << std::endl;
      }
   }

private:

};

--------------------------------------------------------------------------------------------------------------------------------
Compilation Errors:

testVectorIteratorInClass.cpp: In member function `void A::f(const
std::vector<T, std::allocator<_CharT> >&)':
testVectorIteratorInClass.cpp:16: error: expected `;' before "it"
testVectorIteratorInClass.cpp:17: error: expected primary-expression
before ',' token
testVectorIteratorInClass.cpp:17: error: `it' was not declared in this
scope
testVectorIteratorInClass.cpp:17: error: expected `;' before ')' token
 




 7 Posts in Topic:
Doesn't Compile, Why?
liam_herron <liam_herr  2008-04-22 12:55:52 
Re: Doesn't Compile, Why?
liam_herron <liam_herr  2008-04-22 13:04:20 
Re: Doesn't Compile, Why?
=?UTF-8?B?RXJpayBXaWtzdHL  2008-04-22 20:04:34 
Re: Doesn't Compile, Why?
liam_herron <liam_herr  2008-04-22 13:16:28 
Re: Doesn't Compile, Why?
"sk_usenet" <  2008-04-22 13:43:59 
Re: Doesn't Compile, Why?
Joe Greer <jgreer@[EMA  2008-04-23 15:08:35 
Re: Doesn't Compile, Why?
Joe Greer <jgreer@[EMA  2008-04-23 15:58:30 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 8:23:09 CDT 2008.