News for hackers. Stuff that matters.
Re:Show HN: C++11 inline object definitions by klmr on Wednesday May 07, 2014 @11:54AM (#7710851)
> returning more than 1 object from a function without return pointers in the args

Actually that’s solved by returning `std::tuple` and `std::tie` – or using custom classes.

Re:Show HN: C++11 inline object definitions by matt42 on Wednesday May 07, 2014 @12:03PM (#7710922)
Except that it is a bit less error prone. When using std::tie, your have to know the order in which the argument are returned, and you will have bugs the day the maintainer of the library will change it. With iod, you code does not depend on this order anymore.
Re:Show HN: C++11 inline object definitions by unfamiliar on Wednesday May 07, 2014 @01:03PM (#7711330)
> using std::tie, your have to know the order in which the argument are returned

How is this any different than needing to know the order in which the arguments are passes? (Which I happen think is a problem that needs solved.)

Re:Show HN: C++11 inline object definitions by matt42 on Wednesday May 07, 2014 @01:50PM (#7711641)
The slight difference is that the order of the arguments is stated in the api of the library (which does not solve the problem though). The problem may be solved by passing an iod as single argument:

  fun(iod(arg1_ = 1, arg2_ = "foo")); 
or by using method chaining : http://www.parashift.com/c++-faq-lite/named-parameter-idiom....
Re:Show HN: C++11 inline object definitions by blt on Wednesday May 07, 2014 @03:40PM (#7712245)
or just define a struct and return that. named field access, type safe, efficient, IDE friendly. sometimes wonder why people are so keen to do something else.