Skip to content

P0196R2 -- none() and nested optional #14

@akrzemi1

Description

@akrzemi1

The examples in the paper show how I can disambiguate the type of none in the following case:

optional<unique_ptr<int>> o1 = none<optional>;
assert (!o1);

optional<unique_ptr<int>> o2 = none<unique_ptr>;
assert (o2);

But I cannot figure out, if it helps me with initializing an optional optional:

optional<optional<int>> o1 = none<optional<int>>; // possbile?
assert (o1);

optional<optional<int>> o2 = none<optional<optional<int>>>; // possible?
assert (!o2);

Does this paper allow me to initialize an optional at any 'depth'?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions