In Modern C++, is there a way to do safe navigation?
For example, instead of doing...
if (p && p->q && p->q->r)
p->q->r->DoSomething();
...having a succinct syntax by using some sort of short-circuiting smart pointer, or some other kind of syntax leveraging operator overloading, or something in the Standard C++ Library, or in Boost.
p?->q?->r?->DoSomething(); // C++ pseudo-code.
Context is C++17 in particular.
Aucun commentaire:
Enregistrer un commentaire