unordered_map

using namespace std;

class test;

class test {
public:
test();
test(const string &x);
test(const test& t);
~test();
test(test &&t) noexcept;
test& operator=(const test& t);
test& operator=(test &&t) noexcept;
void set(const string &s);
test& get(const string &x);
void show();
private:
string s;
test t();
unordered_map<string, test> hval;
//vector<test> aval;
};

Why unordered_map does not work and vector work ?
Before you can use unordered_map you need to include the <unordered_map> header.

Other than that it's not easy to know what problem you might be having. unordered_map is not a drop-in replacement for vector. The two containers are quite different and you most likely will have to rewrite the code when switching between them.
Topic archived. No new replies allowed.