f



map of map.

Hi All,

I want to create a map of key and another map object (it is another
map of key value pairs). I have declared it as
map<int, map<short, short>> mpObj; it gives me an error that, "error:
ISO C++ forbids declaration of =91map=92 with no type". Does this mean I
can not create a map of a map the object? Have I done something wrong?
Any pointers to any tutorial?

Atul.
0
12/1/2008 11:26:07 PM
comp.lang.c++ 49423 articles. 6 followers. Post Follow

6 Replies
1182 Views

Similar Articles

[PageSpeed] 55

aTuL ha scritto:

> I want to create a map of key and another map object (it is another
> map of key value pairs). I have declared it as
> map<int, map<short, short>> mpObj;

You have to write it like this:

map<int, map<short, short> > mpObj;


Note that the next version of C++ will fix this problem.


-- 
Christian Hackl
0
hacki (114)
12/1/2008 11:44:07 PM
aTuL ha scritto:

> I want to create a map of key and another map object (it is another
> map of key value pairs). I have declared it as
> map<int, map<short, short>> mpObj; it gives me an error that, "error:
> ISO C++ forbids declaration of �map� with no type". Does this mean I
> can not create a map of a map the object? Have I done something wrong?
> Any pointers to any tutorial?

On second thought, the >> is probably not the cause of this particular 
error. Have you included <map> and is there a using std::map somewhere?

Here's a minimal example that compiles fine:

#include <map>
int main()
{
   std::map<int, std::map<short, short> > mpObj;
}


-- 
Christian Hackl
0
hacki (114)
12/1/2008 11:54:05 PM
<snip>
>
> map<int, map<short, short> > mpObj;
>

Hard to note if you are new, you need the the space between the two
'>'.

<snip>

0
12/1/2008 11:55:29 PM
On Dec 1, 6:54=A0pm, Christian Hackl <ha...@sbox.tugraz.at> wrote:
> aTuL ha scritto:
>
> > I want to create a map of key and another map object (it is another
> > map of key value pairs). I have declared it as
> > map<int, map<short, short>> mpObj; it gives me an error that, "error:
> > ISO C++ forbids declaration of =91map=92 with no type". Does this mean =
I
> > can not create a map of a map the object? Have I done something wrong?
> > Any pointers to any tutorial?
>
> On second thought, the >> is probably not the cause of this particular
> error. Have you included <map> and is there a using std::map somewhere?

The error he got is reasonable:

map<int, map<short, short>> mpObj;

Could be parsed as:

(map < int) , (map < short) , (short >> mpObj);

And the error "declaration of map with no type" comes from the
seemingly implicit declaration of "map" in "(map < int)".

Jason
0
12/2/2008 3:54:29 AM
If it's hard to write it will be hard to read (especially in a year's time).

So why not divide and conquer?

typedef map<short,short> MapPhoneToMobileT;
typedef map<int, MapPhoneToMobileT> MapCustomerIdToMobileT;

Bill

"aTuL" <atulskulkarni@gmail.com> wrote in message 
news:0f7dab35-5cb1-4cae-be1e-c864043c5ab6@f3g2000yqf.googlegroups.com...
Hi All,

I want to create a map of key and another map object (it is another
map of key value pairs). I have declared it as
map<int, map<short, short>> mpObj; it gives me an error that, "error:
ISO C++ forbids declaration of �map� with no type". Does this mean I
can not create a map of a map the object? Have I done something wrong?
Any pointers to any tutorial?

Atul. 


0
Bill5316 (25)
12/2/2008 8:00:44 AM
On Dec 2, 4:54 am, "jason.cipri...@gmail.com"
<jason.cipri...@gmail.com> wrote:
> On Dec 1, 6:54 pm, Christian Hackl <ha...@sbox.tugraz.at> wrote:

> > aTuL ha scritto:

> > > I want to create a map of key and another map object (it
> > > is another map of key value pairs). I have declared it as
> > > map<int, map<short, short>> mpObj; it gives me an error
> > > that, "error: ISO C++ forbids declaration of ?map? with no
> > > type". Does this mean I can not create a map of a map the
> > > object? Have I done something wrong?  Any pointers to any
> > > tutorial?

> > On second thought, the >> is probably not the cause of this
> > particular error. Have you included <map> and is there a
> > using std::map somewhere?

> The error he got is reasonable:

It's hard to say what is reasonable when it comes to compiler
error messages these days:-).

> map<int, map<short, short>> mpObj;

> Could be parsed as:

> (map < int) , (map < short) , (short >> mpObj);

> And the error "declaration of map with no type" comes from the
> seemingly implicit declaration of "map" in "(map < int)".

Trying to indicate grouping with parentheses in this case
doesn't work.  What the compiler sees (and is required to see,
according to the standard) is:
    symbol  map
    punct   '<', open template arg. list, if map is found at
            global scope and is a template, otherwise less than
    keyword int
    punct   ','
    symbol  map
    punct   '<' (as above)
    short   keyword
    keyword short
    punct   ','
    keyword short
    punct   '>>', which can only be shift right, regardless of
            context
    symbol  myObj
    punct   ';'
Obviously, that token sequence can't be legal, regardless of
whether the compiler finds the symbol map or not.  (If it
doesn't find map, there's no way < can have a keyword typename
as its right argument, and if it does, the opening of the
template arguments must be closed before the ';'.)

The next version of the standard will contain special wording or
grammar productions to the effect that you can close two
template argument lists at once (provided two are open) with a
>> token.

--
James Kanze (GABI Software)             email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
                   Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34
0
james.kanze (9769)
12/2/2008 1:27:06 PM
Reply:

Similar Artilces:

maps maps maps????
Argh!!!! What happened to transparency maps, reflection maps blah blah blah????? (I'm talking about viz renderer / autocad2004 adt). If you can't use transparency maps, then HTF do you create mesh objects (like a grill, railing, mesh with holes)? or even trees? Or 2D people? Billboard and stuff like that? Use the Cutout map under Special Effects. --- stefkeB --- "Henry" <abshhkc@bath.ac.uk> wrote in message news:Xns942BB07D85A90abshhkcbathacuk@138.38.32.81... > Argh!!!! What happened to transparency maps, reflection maps blah blah > blah????? (I'm talking about viz renderer / autocad2004 adt). > > If you can't use transparency maps, then HTF do you create mesh objects > (like a grill, railing, mesh with holes)? or even trees? Or 2D people? > Billboard and stuff like that? > "stefkeB" <stefkeB@hotmail.com> wrote in news:1068214235.60416 @seven.kulnet.kuleuven.ac.be: > Use the Cutout map under Special Effects. > > --- stefkeB --- > > "Henry" <abshhkc@bath.ac.uk> wrote in message > news:Xns942BB07D85A90abshhkcbathacuk@138.38.32.81... >> Argh!!!! What happened to transparency maps, reflection maps blah blah >> blah????? (I'm talking about viz renderer / autocad2004 adt). >> >> If you can't use transparency maps, then HTF do you create mesh objects >> (like a grill, railing, mesh with holes)?...

map that maps to iterators in the same map ?
Hi, I wonder if it's possible to implement something like typedef map<string, T::iterator> T; i.e. to have a map that will resolve keys to iterators in the map of the same type. In my situation, I'll have only one such map and can guarantee that all iterators will remain valid (I'll only add stuff). Do such recursive constructions known to cause problems? I can use pointers instead of iterators, but it will be much uglier. Thanks, Vladimir ...

STL: Map of maps possible, but no multi-map of maps? Workarounds?
It's possible to do this: map<double, map <string, int> > foo; but not this or any other nested variant using multimap: multimap<double, map <string, int> > foo; Any known (or unknown) workarounds? Thanks Marcus Marcus wrote: > It's possible to do this: > > map<double, map <string, int> > foo; > > but not this or any other nested variant using multimap: > > multimap<double, map <string, int> > foo; Works with comeau online 4.3.3, also with g++ 3.4.2 hmmm... you're right, i must have a bug somewhere. gl...

Help, Map of map
Hello, I'm italian then sorry for my bad english: In this source #include <iostream> #include <map> #include <string> map <string, map <string, int> > PG; int main() { PG.insert (map <string, map<string, int> >::value_type ("pippo", map<string, int>::value_type ("pluto", 6))); // Error std::cout << PG["pippo"].first << std::endl; // Error return 0; } How can I insert a key and value in a internal map? How I get the key and value of internal map? Thanks "Noixe" <No...

map within map
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! ] 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! ] 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! ] ----- Original Message ----- From: "Cleber" <cleberc@gmail.com> Newsgroups: comp.lang.c++.moderated To: <Usenet> Sent: Friday, August 26, 2005 3:11 PM Subject: map within map > Is there any problem in using of map as declared below? > > map<int, map<int, float...

How to render vertex map, normal map and color map
Hello everyone! I'm trying to achieve 3D reconstruction using MS Kinect sensor. I've already got the Vertex Map, Normal Map and Color Map from raw depth map and RGB image. Now I'm wondering how to render these maps(vertex map, normal map and color map) using opengl. Looking forward to your help! Thanks in advance. On Friday, 11 May 2012 05:20:18 UTC+2, Yuan Gao wrote: > Hello everyone! > I'm trying to achieve 3D reconstruction using MS Kinect sensor. > I've already got the Vertex Map, Normal Map and Color Map from raw > depth map and RGB image. > Now I'...

How to implement a map of maps?
Hi! I am trying to implement a map of maps like this: typedef map<string, map<string, string> > stringMap; stringMap myMap; This does not work and I get the following compiler error: --- /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ bits/stl_pair.h: In constructor `std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with _U1 = char*, _U2 = char*, _T1 = const std::string, _T2 = std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<const std::string, std::string> > >]': src/png.cpp...

[SOT] Map, map, who's got the right map?
This from the "GUI gone weird" department. http://news.bbc.co.uk/sport2/hi/olympics/7493757.stm is an interactive BBC map for the olympic venue which will show up later this or early next month. The behavior upon grabbing and moving the map with the mouse is particularly interesting, and not exactly correct. In Google Maps, the grab function is pretty much as one might expect; one grabs, moves the mouse cursor, and the map moves, keeping the point grabbed underneath the cursor, as far as it can. Very reasonable behavior. Not so in the above map; I'm not even sure I can char...

How to work with PERM/TEMP failures on socket map (or LDAP map or HOST map)
Hello, I have a misunderstanding of the socket map protocol as written in op, which is the same as stated in this post: http://groups.google.com/group/comp.mail.sendmail/browse_thread/thread/f91016c9b8d92c61/a392fcbdbf57a50d?hl=en When a socket map returns PERM or TEMP, the code stuffs the fact into a stat pointer, the explanatory message is dropped. In the end I have the following entry in a sendmail -d session: map_lookup(reroute, key) => NOT FOUND (69) but the socket map returned PERM No such map Funnily I found similiar in the host map, too: map_lookup(host, myhost) => host_m...

suprised by destructive map (not map!)
Occasionally I run into bits of ruby that are surprising to me (although might not be to matz). Here is one of them. Should I file this as a bug (I thought .map is supposed to be non-destructive), or just keep in mind which classes are passed by value and which are passed by reference. Basically: map (and naturally also map!) is destructive when your array includes elements which are normally not passed by value but by reference. ruby 1.8.6 (2007-09-24 patchlevel 111) [x86_64-linux] boris:falcon:~:irb "unexpected (for me)" irb(main):001:0> array = [[1],[2]] => [[1], [2]] irb...

Overlaying Maps with mapping toolbox
Hello, I am trying to overlay maps in the mapping toolbox, but I am running into some difficulty with transparency. I have a tiff image of the moon; very similar data to moonalb (see 'load moonalb'); and I plot that using geoshow, i.e.: figure;axesm mollweid framem; hm = geoshow(moonalb,moonalbrefvec); I then try to plot additional data with the geoshow command in surface mode.: h = geoshow(x,[1 -90 -90],'DisplayType','surface'); but the new surface is on top of the previous map. I can change the zdata height, and different portions of the map appear through the su...

Google maps: maps not loading
The maps are not loading in IE, but they do in Opera browser. I tried all the guggestiond from ther HELP and installed DirexcXnew, but nothisg helps. Who can help? Har "hvdh" <geen@nergens.nl> wrote in message news:47e2c638$0$25480$9a622dc7@news.kpnplanet.nl... > The maps are not loading in IE, but they do in Opera browser. I tried > all the guggestiond from ther HELP and installed DirexcXnew, but nothisg > helps. > Who can help? So you have tried clearing web browser cache, enabled JavaScript, ActiveX and binary behaviors at least for Goog...

maps.states to maps.msa??
I found the county and state map databases. Is there one for msa? I have a proc gmap for states, but I rally want to delinneate by msa. Thanks! Is the following what you are looking for? http://listserv.uga.edu/cgi-bin/wa?A2=ind0612b&L=sas-l&P=60628 Art ------------ On Mar 2, 9:33 am, "firepit" <FirePitMa...@gmail.com> wrote: > I found the county and state map databases. Is there one for msa? I > have a proc gmap for states, but I rally want to delinneate by msa. > > Thanks! ...

bump map from normal map ?
Is it possible to go backwards, and (re)create a (correct) height map from a normal map? Is there any code already out there that does this? Thanks. New Guy wrote: > Is it possible to go backwards, and (re)create a (correct) height map from > a normal map? It sounds nice but in practice I suspect it would be very inaccurate. > Is there any code already out there that does this? > Try comp.graphics.algorithms -- <\___/> / O O \ \_____/ FTB. For email, remove my socks. In science it often happens that scientists say, 'You know that's a really good argument; my position is mistaken,' and then they actually change their minds and you never hear that old view from them again. They really do it. It doesn't happen as often as it should, because scientists are human and change is sometimes painful. But it happens every day. I cannot recall the last time something like that happened in politics or religion. - Carl Sagan, 1987 CSICOP keynote address New Guy wrote: > Is it possible to go backwards, and (re)create a (correct) > height map from a normal map? Theoretically: Yes. A normal map represents the partial derivates of the height/bump map. To get the height map back you have to integrate the total differential. The total differential is the sum of all partial derivates. Now the problem: Usual normal maps have 8 bits precision per channel/vector component. This is too low for numerical integration. Allthough there...

map
hi, all Is there any C lib implentments map like c++? xuchm said: > hi, all > > Is there any C lib implentments map like c++? A C++ map is merely an associative container (i.e. a bucket into which you can chuck paired up keys and payloads, such that, given the key, you can get the payload) that (IIRC) observes certain complexity guarantees. It is quite simple to write something of the kind in C, in any of a number of ways - e.g. a self-balancing binary search tree (red-black, AVL, splay, roll-your-own, etc) or a hash table. Relevant libraries are ten a penny, or cheaper. ...

map
I have an imageID and a pair of (X,Y) coordinate how can I map( X,Y) coordinate as a key to imageID? for example (1,1) -> image1 (2,1) -> image5 (5,4) -> image12 (1,9) -> image8 .... etc what Class object i should use? any example code ? Joy Maitland wrote: > I have an imageID and a pair of (X,Y) coordinate > > how can I map( X,Y) coordinate as a key to imageID? > > for example > > (1,1) -> image1 > (2,1) -> image5 > (5,4) -> image12 > (1,9) -> image8 > ... etc > > what Class object i should use? [snip] What about: typedef int x_coordinate; typedef int y_coordinate; typedef std::pair< x_coordinate, y_coordinate > cartesian_2d; typedef std::map< cartesian_2d, imageID > image_map; Best Kai-Uwe Bux On Sun, 23 Nov 2008 01:33:12 -0500, Kai-Uwe Bux <jkherciueh@gmx.net> wrote: >Joy Maitland wrote: > >> I have an imageID and a pair of (X,Y) coordinate >> >> how can I map( X,Y) coordinate as a key to imageID? >> >> for example >> >> (1,1) -> image1 >> (2,1) -> image5 >> (5,4) -> image12 >> (1,9) -> image8 >> ... etc >> >> what Class object i should use? >[snip] > >What about: > > typedef int x_coordinate; > typedef int y_coordinate; > > typedef std::pair< x_coordinate, y_coordinate > cartesian_2d; > typedef std::map< cartesian_2d, imag...

Map
Hi all I must write an applet which has a map picture for gps,but I dont know how to put a map picture into applet Which image component can help me ? This component can be listened by mousemotionlistener also. If any example exists,can you send to my email or here csselo@yahoo.com.au thanks ...

map
my image 256x256x3,uint8,truecolor. how to make a map from that? use "map = colormap" ? thx u. On Jun 14, 11:25=A0am, "laihan laihan" <laiha...@hotmail.com> wrote: > my image 256x256x3,uint8,truecolor. > how to make a map from that? > use "map =3D colormap" ? > thx u. -------------------------------- laihan laihan: No, that won't do it. Check out the rgb2ind() function in the Image Processing Toolbox. Otherwise, look here: http://en.wikipedia.org/wiki/Color_quantization Good luck, ImageAnalyst ...

PDF Map content via Google Maps, Google Earth, and Microsoft Live Maps (Virtual Earth)
LaudonTech announces solutions designed to share an organizations mapping data (PDF Maps, GIS Data (SHP, CAD, MapInfo. etc.)) via Google Maps, Google Earth, and Microsoft Live Maps (Virtual Earth). LaudonTech takes your valuable mapping content and serves it up alongside your favorite online mapping site at a very low cost. No GIS hardware or software is required. Now maps such as garbage collections zones, latest community plan maps, parcel maps, street maps, forest development plan maps can be quickly shared with your target audience via the web. Visit http://www.laudontech.com to...

mapping of XML types to C/C++ built-in types
Hello, Does W3C defines a standard for mapping XML types to C/C++ built-in types and vise versa? Thank you, Alona Hi Alona, "Alona" <allab@sympatico.ca> writes: > Does W3C defines a standard for mapping XML types to C/C++ built-in > types and vise versa? I don't think there is such a thing as XML type. Schema languages (e.g., W3C XML Schema) normally define primitive types. Some of them can be mapped to C/C++ fundamental types but I don't think W3C defines such a mapping. One proprietary mapping of XML Schema built-in types to C++ types is described in this document: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.5 hth, -boris -- Boris Kolpackov Code Synthesis Tools CC http://www.codesynthesis.com Open-Source, Cross-Platform C++ XML Data Binding "Alona" <a...@sympatico.ca> writes: > Does W3C defines a standard for mapping XML types to C/C++ built-in > types and vise versa? FWIW, you can see our schema to C++ type mappings at: http://www.tech-know-ware.com/lmx/lmx-start.html#BenefitsofUsingLMX HTH, Pete. -- ============================================= Pete Cordell Tech-Know-Ware Ltd for XML to C++ data binding visit http://www.tech-know-ware.com/lmx/ http://www.codalogic.com/lmx/ ============================================= ...

How to rotate a map (Mapping toolbox help)
I am new to the mapping toolbox, and want to rotate a map that I draw (see the link). http://i469.photobucket.com/albums/rr56/Toolglutton/map.png Anyone can tell me which function I should use? Thanks. > I am new to the mapping toolbox, and want to rotate a map that I draw (see the link). > > http://i469.photobucket.com/albums/rr56/Toolglutton/map.png > > Anyone can tell me which function I should use? It's not clear if the link shows your desired result, or a result that you want to change. If it's the former, the following script should get you star...

Probability map (p-map) and ROI
Hi, What resources do you recommend for learning "Probability maps (p-map)" and its use to determine the ROI (Regions Of Interest)? Thanks. "Abder-Rahman" <abder.rahman.ali@gmail.com> wrote in message <iekj5b$28r$1@fred.mathworks.com>... > Hi, > What resources do you recommend for learning "Probability maps (p-map)" and its use to determine the ROI (Regions Of Interest)? > > Thanks. I have the same problem. Help us. Thanks ...

Mapping Aster GDEM map in MATLAB
i have a Aster GDEM map of size (3601*3601) 16 bit in .tif format but can not plot it in MATLAB. ...

Google Maps...CRUSHES Apple Maps
Ya can't argue with quality, or success. http://www.fool.com/investing/general/2014/06/16/google-maps-hits-1-billion-downloads-while-apple-m.aspx Google Maps Hits 1 Billion Downloads, Leaving Apple Maps in the Dust On 2014-06-16 19:50:09 +0000, Puffin Killer said: > Ya can't argue with quality, or success. > > > http://www.fool.com/investing/general/2014/06/16/google-maps-hits-1-billion-downloads-while-apple-m.aspx > > > Google Maps Hits 1 Billion Downloads, Leaving Apple Maps in the Dust LOL On 2014-06-16 20:38:11 +0000, Alan Bake...

Web resources about - map of map. - comp.lang.c++

Map - Wikipedia, the free encyclopedia
A map is a symbolic depiction highlighting relationships between elements of some space, such as objects , regions , and themes. Many maps are ...

Map - Wikipedia, the free encyclopedia
A map is a visual representation of an area – symbolic depiction highlighting relationships between elements of that space such as objects , ...

MAPS - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Google Maps makes it easier to hail a ride that isn't Uber
Filed under: Transportation Alternatives Google is teaming up with a bunch of new providers and integrating their services into Google Maps. ...

Microsoft: 'Exciting update' coming for Windows 10 Maps app
... of top-notch navigation apps. Microsoft is well aware of this though, promising an "exciting update" to beef up its own offering, Windows Maps. ...

Google Maps Integrates Ride Services With Dedicated ETA Tab, Fare Estimates
Starting today, users of Uber can simply open up the Google Maps app, plug in a destination, then get detailed information on whether an Uber ...

Google Maps makes it easier to hail a ride that isn't Uber
For almost two years now you've been able to open up the Google Maps app, type in a destination and see how much an Uber would cost. If you like ...

New Map Of The Milky Way Is Complete; Reveals Our Galaxy's Future Stars
Each new wavelength of light can teach us something different about space. This highest-resolution view of the Milky Way shows us where our future ...

Windows 10 phones lose HERE Maps support, Windows 8 devices won’t get new HERE features
Via HERE. HERE Maps, the one-time Nokia-owned navigation and mapping app that Audi, BMW and Mercedes bought last year , is dropping support ...

Keep Track of Every Mission Throughout The Solar System With This Handy Map
There’s been dozens of probes that have gone out exploring the solar system since 1959's Luna 2 probe. PopChartLab has gone and noted down each ...

Resources last updated: 3/17/2016 2:22:39 AM