map « std « C Q&A

Home
C Q&A
1.assembly
2.buffer
3.Card
4.Cast
5.compile
6.console
7.const
8.constructor
9.database
10.Date
11.Debug
12.Design
13.Development
14.DLL
15.encrypt
16.enum
17.eof
18.Event
19.fork
20.Format
21.gcc
22.gdb
23.graph
24.graphics
25.gui
26.Holiday Event
27.image
28.IP
29.iterator
30.macro
31.makefile
32.malloc
33.Menu
34.mysql
35.network
36.openssl
37.operator
38.password
39.pipe
40.preprocessor
41.printf
42.pthread
43.Regular expression
44.scanf
45.semaphore
46.SerialPort
47.server
48.Socket
49.sql
50.SQLserver
51.sscanf
52.std
53.stdin
54.stdout
55.stl
56.strcmp
57.stream
58.switch
59.Template
60.thread
61.timer
62.unix
63.video
64.Virtual
65.visualstudio
66.winapi
67.windows
68.xml
C Q&A » std » map 

3. std::set within std::map problem    bytes.com

Wow, that helped. Thanks a lot vmpstr! I would never had guessed that an extra "typename" would have solved this. Thought that since i put "template " in the signature the compiler would be aware of everything concerning "T"'s. But i guess that the "typename map >::iterator" type is kind of complex.. :) Thanks for the help and explanation! ...

4. Re: Is a std::map<> ordered?    bytes.com

Pete Becker wrote: > >On 2008-11-20 14:40:19 -0500, acehreli@gmail.com said: >> >>On Nov 20, 7:48 am, Juha Nieminen >>joseph cook wrote: >>>>A map is always sorted using std::less >>>> >>>Not always. By default, yes, but you can specify other comparators, e >>g: >>>> >>>std::map>> >>Or at runtime: >>> >>std::map>> >> >Not really. There's a third ...

5. unable to read from const std::map<>&    bytes.com

The const has nothing to do with it. It's your use of operator[] in the the cout in line 9. That operator returns a reference to the map element. It's possible to change the map byusing this reference. Your const gets in the way of that and you get a compile error. Either: a) don't use const or b) use const ...

6. Performance of the std::map during a search    bytes.com

Hi, I am writing code that is using std::map and having a bit of an issue with its performance. > It appears that the std::map is significantly slower searching for an element then a sequential search in a vector. > Has anyone run into this before? > Do you use map.find ? Otherwise post some ...

7. behavior of a std::map I don't understand...    bytes.com

I'm using Visual Studio 2005, but i don't think that's (primarily) where I've gone wrong. I was experimenting, trying, by the way, to move into writing my own iterator so that I can learn, ultimately, to write templates: std::map< int, char [12] cm; char str0[12] = {'f','i','r','s','t',' ','t','e','x','t','\0'}; cm[0] = str0; The compiler says about that assignment, left operand must be ...

8. intersection of two std::maps    bytes.com

Hi! What is the canonical way of finding an intersection of two std::maps? i.e. I have std::map

9. thread safety and std::map    bytes.com

digz Hi, I am trying to write a program which has two threads one of them write to a map , and the other one deletes entries based on a certain criterion.. first I cannot get the delete portion to work , what am i missing here. also is it possible/correct that the removeKeyValue function acquire the mutex lock only during ...

10. saving a std::map instance into harddisk    bytes.com

Hi, I have a std::map instance that I want to save into harddisk so that I donot have to recompute it each time. The map itself is keyed by a string and the values are pointers to other objects. Is it possible the whole data structure so that it can be loaded later? Thanks

11. std::map and multithreaded access    bytes.com

Hi Folks I know the C++ standard doesn't talk about threads. However I am a little bit curious as to what might or might not happen with a particular scenario I encountered in my project. Its w.r.t to STL containers so I didn't know where else to post. insights appreciated: my application iterates over a stl::map to do some processing on ...

12. std::map Help    bytes.com

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hey all. I've got a problem I can't seem to figure out. I'm writing a program that deals with money in multiple currencies. In order to define the various currencies, I've created a class called Currency. I then have a map that looks like this: std::map currency; The key to this array is the ...

13. How to use std::copy with std::map?    bytes.com

Should the following work? It does on some compilers. How can I get it to work on g++ 3.2? On g++ 3.2 it keeps telling me that there is no such function operator << for ostream and pair. But there is! And I can call it! And it works! So why cannot std::copy find it? thanks, Siegfried template ...

14. std::map problem with inherited classes    bytes.com

Hi, everybody I'm working with STL container map to store an element. Everything happens well when I've an simple class (whit no inheritance). But if using inherited classes I got some estrangs behaviors Ex. Class1 { public: int value; Class1(int value) { this->value = value; } Class1(); } Class2 : public Class1 { public: int value2; Class2(); Class2(int value1, int value2) ...

15. problem with std::map    bytes.com

hello! this the code! std::map::iterator iter=transactions.find(transaction); if(iter != transactions.end()) { return iter->second; //return transactions.[transaction]; } else return NULL; How can I get a copy of iter->second?which is the best way? Sercices is a base class and I want a copy of the derived. these objects are proxies for services. the reason i want a copy is becouse I dont want to ...

16. std::map    bytes.com

2 questions: Given a map defined as std::map stringmap; //How do you access the data_type (string) via an iterator? std::string spoo("doh"); stringmap.insert(std::make_pair(1,spoo)); // I tried this: for(std::map ::iterator it = stringmap.begin(); it != stringmap.end(); ++it) std::cout << *it; But this doesn't compile with error that the operator+ has not been defined .... I think the problem is that the iterator returns ...

17. What does it do "static std::map m_mId2Instance;"    forums.devshed.com

An object of type u32 is the key. A pointer to an object of type temp is the data. Think of it in terms of object types you may understand. std::map m_mymap; For this map, an object of type int is the key and an object of type string is the data. To store some string in the map, you'll ...

18. What's the problem of this std::map?    forums.devshed.com

class A{ public: A(){ cout<<"Class A"< > ); }; int main(){ A * a = new A; B * b = new B; vector v; v.push_back(b); map > m; m[a] = v; Test t; t.start(m); return 0; } What does this error ...

19. Iteration order of std:map    forums.devshed.com

20. Plenty of std::map confusion    forums.devshed.com

I have performed a connected component analysis on an image and now must find the extreme coordinates (both x and y) of each connected component. To do this, I am using an "array of mappings" for "convenience." The array is as follows: top-left x coordinate, top-left y coordinate, bottom-right x coordinate, bottom-right y coordinate. Now I am utterly confused. I need ...

21. std::Map inside of a std::map problems...    forums.devshed.com

22. std::map - address of "second"    forums.devshed.com

My example: - a map like this: std::map - a method MethodA() that knows the map - a method MethodB() that doesn't know the map but needs the "MyStruct" of one of the elements I tried this way: - MethodB() calls MethodA() with a parameter "MyStruct* p". - MethodA() searches the element in the map using an iterator and "find()". ...

23. std::map    forums.devshed.com

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.