0

I have the following code:

void readTable(const Table& table)
{
  for (auto& r: table)
    {
      auto state = r["UX"] == std::string("Yes");
      std::cout << state << '\n';
    }

}

table is defined as

using Row = std::map<std::string, std::string>;
using Table = std::vector<Row>;

My table read function does not change the Table, so I added the const to the readTable(const Table& table). Compiler does not like this change. Is this not the right way of telling the compiler that the table is not supposed to change ?

Ring Zero.
  • 459
  • 3
  • 12

0 Answers0