Date: Thu, 25 May 2023 16:25:25 +0200
p = nullptr;
std::cout << q->>size() << p->>size() << r->>size() << std::endl; // nothing happens??? What does this mean?
Object a{ p->>size() }; // nothing happens???
a.dosomething(); // UB? Never initialized
Those error-ignoring functionalities (stops automatically when it encounters a nullptr and nothing happens) are not the typical C++ way or direction IMHO. We want to have proper error handling either with pre-/post-conditions and/or with exceptions or error codes.
Otherwise we get a language and programs, which does something defined in every case, but seldom the thing we wanted.
-----Ursprüngliche Nachricht-----
Von:Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:Do 25.05.2023 15:32
Betreff:[std-proposals] Fwd: Chaining of the -> operator for std::optional< std::list<T>::iterator >
An:std-proposals <std-proposals_at_[hidden]>;
CC:Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>;
But anyway maybe we could have a new operator such as '->>' which
stops when it encounters a nullptr. For example if you do:
(***p).size(); // undefined behaviour
p->>size(); // nothing happens
Received on 2023-05-25 14:25:27