Quantcast
Channel: Unknown type name error when inserting into unordered_map - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Bo R for Unknown type name error when inserting into unordered_map

$
0
0

Your std::make_pair is wrong. To get closer you need a std::set<int> instead of the std::set.

But what you really want is to just let to compiler make it for you:

    firstSets.insert(std::make_pair(decl, declFirstSet));

or use an easier syntax:

    firstSets[decl] = declFirstSet;

EDIT AFTER UNDERSTANDING THE PROBLEMOn the otherhand, you want firstSets to come with initial content you can reorder the declarations:

#include <set>#include <string>#include <unordered_map>std::string decl{"decl"};std::set<int> declFirstSet{1, 2, 3, 4};std::unordered_map<std::string, std::set<int>> firstSets{{decl, declFirstSet}};int main() {}

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>