Skip to content

Forwarding ref. and variadic make_optional overloads missing #30

@daniel-j-h

Description

@daniel-j-h

The stdlib provides forwarding ref. overloads and variadic template overloads for make_optional:
http://en.cppreference.com/w/cpp/utility/optional/make_optional

The same is missing from boost::optional at least from what I can tell (correct me if I'm wrong).

All I could find here are these two overloads:

optional<T> make_optional ( T const& v )
optional<T> make_optional ( bool cond, T const& v )

Which is sub-optimal since now users expecting a move will end up doing a copy instead:

boost::make_optional(std::move(bigObject)); // oops, calls T const& overload making a copy

cc @K-ballo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions