I personally try to always use std::optional<T> the same as T*
To get access to a method of the inner object: <https://en.cppreference.com/w/cpp/utility/optional/operator*> operator-> <https://en.cppreference.com/w/cpp/utility/optional/operator*> So to get the content : <https://en.cppreference.com/w/cpp/utility/optional/operator*> <https://en.cppreference.com/w/cpp/utility/optional/operator*> <https://en.cppreference.com/w/cpp/utility/optional/operator*> <https://en.cppreference.com/w/cpp/utility/optional/operator*>operator* And to test if it contains a value `operator bool` This is also consistent with Expected<T, F> , unique_ptr, RefPtr etc. So I agree with you, to me, it makes it more concise and readable. I’d be happy if that went into the coding style. > On 25 Nov 2024, at 9:03 pm, Anne van Kesteren via webkit-dev > <webkit-dev@lists.webkit.org> wrote: > > https://commits.webkit.org/238290@main seemed to express a preference > for using * over value(), but the Code Style Guidelines are silent on > this. Is this something we can establish a guideline for? > > I personally think * makes the code slightly more readable due to it > being more concise. > _______________________________________________ > webkit-dev mailing list > webkit-dev@lists.webkit.org > https://lists.webkit.org/mailman/listinfo/webkit-dev
_______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-dev