for (std::size_t iter = 0; iter != m_queryMap.size(); ++iter)
{
// note here, line = iter + 1;
std::set<std::size_t> lineBuck;
lineBuck.insert(iter + 1);
const std::vector<std::string>
&bucket = m_queryMap.at(lineBuck);
}
where
std::map<std::set<std::size_t>, std::vector<std::string> > m_queryMap; // storing each line of input
// crossed with the line number as its key
yup, I know I could've used std::size_t only as the key for the map.
but it was said in the book that:
We'll use a set to hold the line numbers on which each word in the input appears. Using a set guarantees that each line
will appear only once and that the line numbers will be stored in ascending order;
which what the keys of the map is exactly doing without the need of set, so it's kind of weird, but not only that, it give me hard time to access the respective element inside the map due to type conversion and out_of_range error; so how exactly the method that I could've have used?
been trying:
accessing through std::set<std::size_t> member that stored the value in-beforehand but then failed due to un-able to access it and having a hardtime with type conversion.