map<string,string> error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • drjay1627
    New Member
    • Nov 2008
    • 19

    map<string,string> error

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

    Code:
    while(!myHuffFile.eof()){
    		string word, code;
    		int freq;
    		myHuffFile >> word >> freq >> code;
    		if(word == ""){
    			break;
    		}else{
                            _fileMap.insert(pair<string,string>(word,code));
    			_freqMap.insert(pair<string,int>(word,freq));
    		}
    	}
    error:

    error: conversion from `std::_Rb_tree_ iterator<std::p air<const std::string, std::string> >' to non-scalar type `std::_Rb_tree_ iterator<std::p air<const std::string, int> >' requested

    can you please help me with this.

    thanks

    drjay
  • Savage
    Recognized Expert Top Contributor
    • Feb 2007
    • 1759

    #2
    How did you declare these two maps?

    Comment

    • drjay1627
      New Member
      • Nov 2008
      • 19

      #3
      figured it out... thanks!

      Comment

      Working...