+1 Tuple

On Wed, Oct 4, 2017 at 7:58 AM, David Kimura <dkim...@pivotal.io> wrote:

> +1
>
> On Tue, Oct 3, 2017 at 5:45 PM, Hitesh Khamesra
> <hitesh...@yahoo.com.invalid
> > wrote:
>
> > Tuple option.
> >
> > Sent from Yahoo Mail on Android
> >
> >   On Tue, Oct 3, 2017 at 4:27 PM, Jacob Barrett<jbarr...@pivotal.io>
> > wrote:   Voting on the conversation around C++ return values vs. out
> > parameters.
> > This vote is to adopt the standard of return values over the use of out
> > parameters. On functions that must return more than one value to use the
> > C++11 std::tuple type for future compatibility with C++17.
> >
> > For example:
> >
> > std::tuple<int, std::string> foo::getAAndB() {...}
> >
> > And call it with:
> >
> > int a;
> > std::string b;
> > std::tie(a, b) = foo.getAAndB();
> >
> > Alternatively the tuple can be called like:
> >
> > auto r = foo.getAAndB();
> > auto a = std::get<0>(r);
> > auto b = std::get<1>(r);
> >
> > In C++17:
> >
> > auto [a, b] = foo.getAAndB();
> >
> >
> >
> > Rather than:
> >
> > int foo::getAAndB(std::string& b) {...}
> >
> > Called like
> >
> > std::string b;
> > auto a = foo.getAAndB(b);
> >
> > -Jake
> >
> >
>

Reply via email to