By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,261 Members | 1,325 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,261 IT Pros & Developers. It's quick & easy.

a question on vector declaration

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a

"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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.