C++ Logo


Advanced search

Re: [SG12] [isocpp-lib-ext] (draft) The simple truth about references

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Fri, 7 Feb 2020 14:25:51 +0200
On Fri, 7 Feb 2020 at 14:23, Corentin <corentin.jabot_at_[hidden]> wrote:
> My mental model for optional (and i know there are a lots of disagreement about what the correct mental model is or ought to be) is that of a container that may contain 0 or 1 value.

"Lots of disagreement", but yet consensus for the current semantics? :)

> Under that model, assignment from T makes little sense, and it is easier to see why T& should be supported: optional is a container and doesn't care about the nature of the
> thing it may contain.

And yet our containers do not support references as element types.

Received on 2020-02-07 06:28:41