Skip to content

Why is operator() of function views non-const? #1211

Answered by Neverlord
melg8 asked this question in Q&A
Discussion options

You must be logged in to vote

The function view isn't const, because:

Use const to define objects with values that do not change after construction

Now, technically the function view could get away with const since it wraps an actor handle. Semantically, the "function" changes its state whenever you call it. We decided to not make the function call operator const to make it clear that there are state changes whenever you call it. It's still message passing underneath.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Neverlord
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
Converted from issue

This discussion was converted from issue #1158 on January 22, 2021 14:03.