-
Notifications
You must be signed in to change notification settings - Fork 258
[BUG] Permit operator=
with in this
(via function metafunction @proxy
)
#452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What is the use case for an assignment on a const object of type pair? |
Ouch that reads like such a hack... Maybe we could treat it like the weird constructor of |
Another use-case is |
This behaviour is useful for proxy references, maybe it should only be allowed if the class is immutable, so no data members are present, or all members are const? |
Because |
I suggest restriction of immutability to isolate a situation of assignment being const to cases where it is required. The types that Proxy references, such as So having const data members (for example const pointers) is somewhat approriate in such types, and these types are required to have const assignment. |
Class template T operator=(T) const noexcept; 🔗 |
Or maybe not. |
Maybe https://eel.is/c++draft/template.slice.array is a better example. |
I suppose I'd like to be able to implement view types with deep copy semantics. |
According to the link
So they are not copy assignable if i'm not mistaken. |
View with deep copy on assignment would not meet view semantic requirements i think. |
I did not mean a model of Implementing proxies is expert-level. So I think it makes sense to keep the restriction that Instead, I'd suggest adding the function metafunction
|
operator=
with in this
operator=
with in this
(via function metafunction @proxy
)
Title: Permit
operator=
within this
.Description:
There are use cases when the target of assignment isn't part of the value of
this
.For example: https://eel.is/c++draft/pairs#lib:operator=,pair_.
The text was updated successfully, but these errors were encountered: