3 ms·
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 th
by matt42 12y ago
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.
- unfamiliar 12y ago> 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.)
- matt42 12y agoThe 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.html http://www.parashift.com/c++-faq-lite/named-parameter-idiom....
- blt 12y agoor 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.