Skip to content
Discussion options

You must be logged in to vote

Hi @spinicist, glad you've found Flux useful!

I'm curious - why does flux::max() return an optional? Is there a situation where max can "fail"?

Yes -- when called on an empty sequence, there is no "maximal" element, so flux::max() returns nullopt instead. (Note that std::ranges::max() has undefined behaviour in this case.)

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by tcbrindle
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants