473,385 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

a question on vector declaration

Jee
Hi,
I wonder what's wrong with the following,

std::vector<pair<int, int>> myVec;

The compiler always complains that "expect , instead of >>".

Thanks.

Jul 22 '05 #1
5 3668
On Thu, 20 Nov 2003 17:40:06 -0700, Jee <je*@hotmail.com> wrote:
Hi,
I wonder what's wrong with the following,

std::vector<pair<int, int>> myVec;

The compiler always complains that "expect , instead of >>".


">>" is the right shift operator, you need to use:

std::vector<pair<int, int> > MyVec;
And std::pair would make more sense since you are suing std::vector...

--
Sam Holden
Jul 22 '05 #2
Jee
Same error after I change it to

std::vector<std::pair<int, int>> myVec;

Any idea?
Jee wrote:
Hi,
I wonder what's wrong with the following,

std::vector<pair<int, int>> myVec;

The compiler always complains that "expect , instead of >>".

Thanks.


--

_ Hi, this is Je*@hotmail.com _

Jul 22 '05 #3
Jee wrote:
Same error after I change it to

std::vector<std::pair<int, int>> myVec;

Any idea?
...


Read Sam's reply again. He already answered your question.

--
Best regards,
Andrey Tarasevich

Jul 22 '05 #4

"Jee" <je*@hotmail.com> wrote in message
news:3F***************@hotmail.com...
Same error after I change it to

std::vector<std::pair<int, int>> myVec;

Any idea?


Read Sam's reply again, carefully.
is an operator, so that's what the compiler sees it as.


std::vector<std::pair<int,int> > myVec;
^^^

-Mike
Jul 22 '05 #5
On Thu, 20 Nov 2003 18:07:59 -0700, Jee wrote:
Same error after I change it to

std::vector<std::pair<int, int>> myVec;

Any idea?
Jee wrote:
...


It is very simple.
You MUST have a space between th two '>' characters at the end of the
statement. Without the space, the compiler thinks it is a shift operator.

The statement You would should look like this :

std::vector<std::pair<int, int> > my Vec ;

Note the Space between the two '>'

Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Honestmath | last post by:
Hi, I added the following line to my code within a class declaration: std::vector<Date> m_duedates(100); I also tried: std::vector<Date> m_duedates(100, Date());
4
by: John | last post by:
I have a function declaration that gives an error while compiling. Can anyone help me figure this one out? inline void create(const std::vector< myclass >& plist, std::vector< myclass...
2
by: Lovens Weche | last post by:
I'm trying to compile this code with VC++ 7: class KeyboardInterface { public: .....
14
by: Michael Sgier | last post by:
Hello If someone could explain the code below to me would be great. // return angle between two vectors const float inline Angle(const CVector& normal) const { return acosf(*this % normal); }...
3
by: Daniel J Watkins | last post by:
Hi, Some runtime memory exceptions are being exhibited with some code I've written. Can you clarify the following with you to see if my understanding of the principles under question are...
3
by: gamehack | last post by:
Hi all, Here's the error which I'm getting when trying to compile some code: boxmanager.h:16: error: ISO C++ forbids declaration of 'vector' with no type boxmanager.h:16: error: expected...
12
by: y-man | last post by:
Hi, I am creating a child class of the vector, which contains a couple of functions to make the work with carthesian coordinate vectors easier. To make things work more easily, I would like to...
4
by: kungfuelmosan | last post by:
Hey guys, Im just getting into c++ at the moment so please bare with me Basically i need to declare a vector<stringstringArray(50) inside a class, however by doing so i am getting the following...
5
by: subramanian100in | last post by:
I am copying the following text as it is from Stroustrup's TC++PL 3rd edition, page 450. It says: "Note that a constructor given two arguments of the same type can be a match for more than...
6
by: samsneelam | last post by:
Hi.. This is samuel, while doing a program, i encountered this problem.. Let me give you clarity regarding my prob.. I am having two files .. one is mpcplib.h it contains the follwing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.