473,503 Members | 1,657 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

map<string,string> error

19 New Member
I need help with inserting a string for both key and value to a map.

Expand|Select|Wrap|Line Numbers
  1.  
  2. while(!myHuffFile.eof()){
  3.         string word, code;
  4.         int freq;
  5.         myHuffFile >> word >> freq >> code;
  6.         if(word == ""){
  7.             break;
  8.         }else{
  9.                         _fileMap.insert(pair<string,string>(word,code));
  10.             _freqMap.insert(pair<string,int>(word,freq));
  11.         }
  12.     }
  13.  
  14.  
error:

error: conversion from `std::_Rb_tree_iterator<std::pair<const std::string, std::string> >' to non-scalar type `std::_Rb_tree_iterator<std::pair<const std::string, int> >' requested

can you please help me with this.

thanks

drjay
Nov 30 '08 #1
2 1804
Savage
1,764 Recognized Expert Top Contributor
How did you declare these two maps?
Nov 30 '08 #2
drjay1627
19 New Member
figured it out... thanks!
Dec 1 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
6693
by: gipsy boy | last post by:
// -- using namespace std; map<string,string> formMap; list<string> formParams; for(list<string>::iterator fit = formParams.begin(); fit!=formParams.end(); fit++) { cout << "key=" << *fit;...
15
6909
by: keweiming | last post by:
I have a project which needs to open hundreds to thousands of files for writing. The following is a simplified test program I wrote to see if I can use a map<string, ofstream> object to keep the...
11
8735
by: Martin Jørgensen | last post by:
Hi, - - - - - - - - - - - - - - - #include <iostream> #include <string> #include <map> using namespace std; int main() {
2
13158
Soujiro
by: Soujiro | last post by:
typedef struct { int age; string name; } structure; int functionCall( map< char* , structure* >* map_o ) { map< char* , structure* >* map_op; map_op = map_o;
3
2367
by: asclearuc | last post by:
Hello Is it possible to use map<string&, string&>? Why I need it. I have a large amount of data obtained from XML file. I should do processing of this data. The processing takes many...
2
16211
by: jhirshon | last post by:
Can anyone show me how to use a map<string, map<string, int>>? The declaration of the above data structure works, and I think that I can make some entries, but I'm unable to retrieve the entries....
13
3390
by: liujiaping | last post by:
Hi, all. I have a dictionary-like file which has the following format: first 4 column 7 is 9 a 23 word 134 .... Every line has two columns....
6
7334
by: Mr. K.V.B.L. | last post by:
I want to start a map with keys but an empty vector<string>. Not sure what the syntax is here. Something like: map<string, vector<string MapVector; MapVector.insert(make_pair("string1",...
0
7198
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,...
0
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.