-
Notifications
You must be signed in to change notification settings - Fork 425
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
Cannot use class type in Map
value type
#14423
Comments
|
Thanks. You're right; that's rather subtle. Is there intuition as to whether my original code should compile if Is there any relevance here for the expiring-values optimization? My guess is "no" since this is a language semantic and not an optimization. |
Yes, I would expect the original code to compile and work if |
I would write proc always_set(key, in value) {
m[key] = value;
writeln(m);
} When Note also that if the function were declared as
With the
The copy elision for expiring values is not an optimization. It is something that will be described in the language specification. However, we could decide to allow copy elision with I don't have an issue yet proposing the details of the copy elision - #9490 mostly brings up tricky points - but we could discuss further there if you are interested. |
Related #14413
Bug. The
map
data structure does not accept class types for its value type.I haven't tested using a class type for the key type yet. The same could be true.
The text was updated successfully, but these errors were encountered: