News for hackers. Stuff that matters.
Re:Returning multiple values from functions in C++ by matt42 on Monday March 07, 2016 @06:13AM (#11238251)
The problem with deconstructing a tuple is that you can easily make mistake about the order of its members. The struct is a much better solution to me, and you can go over the problem of the weirdly named one-off struct by using the iod library (https://github.com/matt-42/iod):

  foo() { return D(_id = "test", _age = "42" }; }

  auto r = foo();
  std::cout << r.id << r.age << std::endl;
Re:Returning multiple values from functions in C++ by ericfrederich on Monday March 07, 2016 @08:44AM (#11238777)
Meaningful names would be nice.

In C++ iterating over a map items you get a pair with ->first() and ->second() methods instead of key / value.

Python has named tuples which can work both ways.