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,438
  • 68
  • 55
  • 126
vApp
  • 219
  • 4
  • 17

0 Answers0