Longer "equivalent" code (but handles several indirections).
Actual example in the main function:
-----Ursprüngliche Nachricht-----
Von: Richard Hodges via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Do 20.10.2022 13:01
Betreff: Re: [std-proposals] The null-aware arrow operator: ?->
An: std-proposals@lists.isocpp.org;
CC: Richard Hodges <hodges.r@gmail.com>;
On Thu, 20 Oct 2022 at 12:25, Peter Olsson via Std-Proposals <std-proposals@lists.isocpp.org> wrote:If you don't use a colon (:) does that mean the type of the ?-> expression is always void?You can't write the following, can you?std::cout << ptr?->get_value();These are equivalent:ptr ? std::cout << ptr->get_value(), void() : void();ptr ? std::cout << ptr->get_value() : std::cout;if (ptr) std::cout << ptr->get_value();The "optional operator" is unnecessary syntactic sugar found in a couple of populist languages.-->The three-way comparison operator <=> is 3 chars long; ?-> now seems
reasonable IMHO.There are also <<= and >>= so I don't think the length should be controversial.
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
-- Std-Proposals mailing list Std-Proposals@lists.isocpp.org https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals