Allow std::optional::and_then, std::optional::or_else, and std::optional::transform

8 views
Skip to first unread message

Daniel Cheng

unread,
Jan 27, 2026, 5:59:35 PM (4 days ago) Jan 27
to cxx, Dominik Bylica
This is currently specifically banned in https://chromium.googlesource.com/chromium/src/+/HEAD/styleguide/c++/c++-features.md#Monadic-operations-for-std_optional-tbd; I'd like to propose allowing it by default.

For future C++ updates, I'd also propose just default allowing new methods on already-allowed classes when they don't also introduce externally-observable dependencies on banned or TBD library types.

Daniel

Nico Weber

unread,
Jan 27, 2026, 6:48:14 PM (4 days ago) Jan 27
to Daniel Cheng, cxx, Dominik Bylica
lgtm

Part of the reason for the policy is that the TBD->Propose->Allow flow:

1. Raises awareness of new features
2. Makes sure the new features actually work, as allowing something entails adding a use of the thing in the same CL that allows it

So it has some overhead, but maybe that's worth it 🙃

Batching a bunch of these together definitely makes sense to me, though!

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAF3XrKpCHM_Mnsb5NF4THUVBYkSQyuiQyfzRsBN0zjDKg6cgJw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages