insert to boost unordered map
boost, boost-unordered, c++
Solution
Where you find such `insert` method?
std::pair<iterator, bool> insert(value_type const&);
std::pair<iterator, bool> insert(value_type&&);
iterator insert(const_iterator, value_type const&);
iterator insert(const_iterator, value_type&&);
template<typename InputIterator> void insert(InputIterator, InputIterator);
Where `value_type` is
typedef Key key_type;
typedef std::pair<Key const, Mapped> value_type;
from here
You should use `this->input_l1_map.insert(std::make_pair(id, input));`
Problem
Hi I'm trying to insert a record into a boost::unordered_map Map is defined as ``` boost::unordered_map<int,Input> input_l1_map; ``` where Input is the class ``` class Input { int id; std::string name; std::string desc; std::string short_name; std::string signal_presence; std::string xpnt; } ``` I use a function to insert the record as below ``` void RuntimeData::hash_table(int id,Input input) { this->input_l1_map.insert(id,input); } ``` I read the boost documentation it says a function `insert()` to insert data to the container, but when I compile it shows error.