mercredi 2 janvier 2019

How to fix "Hashmap error: " error in C++

I want to use hashmap in C++ in Ubuntu 18.04. Butthis error makes me confusing.

I want to use hashmap in C++ in Ubuntu 18.04. Butthis error makes me confusing.

The complete error code is "Hashmap error: no matching function for call to ‘std::map, int>::find(__gnu_cxx::__alloc_traits

::value_type&)"

#include <iostream>
#include <map> using namespace std;

int main() {
    string s = "dfsfsdfsf";
    int i = 0, j = 0, ans = 0, leng;
    map<string,int> window;
    leng = s.length();
    for(;j < leng; j++){
        if(window.find(s.at(j)) != window.end()){
            i = max(i, window[s.at(j)])
        }
    }
    return 0; }

I do not know what happened. Please someone helps me. ^~^

Aucun commentaire:

Enregistrer un commentaire