0

I am trying to print out a string from a const pair I declared

using Collatz = pair<long, vector<long> >;

However, in this function, it allows me to print the first value with no problems. When I want to print the second value, it makes me add the & symbol to it which then prints out the address. How do I get around this so I can print out the actual value.

string Collatz_to_string(const Collatz &p) {
ostringstream oss;
oss << p.first << "," << p.second;
return oss.str();
}

Candidate function not viable: no known conversion from 'const std::__1::vector >' to 'const void *' for 1st argument; take the address of the argument with &

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
vApp
  • 249
  • 1
  • 6
  • 18

0 Answers0