|
Prev: Pet peeves (lighthearted)
Next: C++/CLI limitations?
From: Cleber on 26 Aug 2005 05:41 Is there any problem in using of map as declared below? map<int, map<int, float>> test; Cleber [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Ulrich Eckhardt on 27 Aug 2005 06:07 Cleber wrote: > Is there any problem in using of map as declared below? > > map<int, map<int, float>> test; Yes, the syntax is wrong as the '>>' is interpreted as shift operator - use '> >' instead. Further, you need the std:: of course and the header <map>. Uli [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Wolfram Roesler on 27 Aug 2005 06:16 "Cleber" <cleberc(a)gmail.com> wrote in news:1124992953.073564.261820 @g49g2000cwa.googlegroups.com: > Is there any problem in using of map as declared below? > > map<int, map<int, float>> test; Yes, you need a space between the two ">" or else they'll be a shift operator for the compiler. So, it should be: map<int, map<int, float> > test; which is not a problem at all. HTH Wolfram [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Nicola Musatti on 27 Aug 2005 06:17 Cleber wrote: > Is there any problem in using of map as declared below? > > map<int, map<int, float>> test; The only problem is due to the adjacent '>' signs that confuse the compiler. Just write it map<int, map<int, float> > test; And everything should be all right. Cheers, Nicola Musatti [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Daniel Krügler on 27 Aug 2005 06:10
Cleber wrote: > Is there any problem in using of map as declared below? > > map<int, map<int, float>> test; There is a problem: The missing space between the two trailing > characters (which is otherwise interpreted as >>). So correct way is map<int, map<int, float> > test; Greetings from Bremen, Daniel Krýgler [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |