Skip to content
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

Forwarding ref. and variadic make_optional overloads missing #30

Closed
daniel-j-h opened this issue Apr 18, 2017 · 1 comment
Closed

Forwarding ref. and variadic make_optional overloads missing #30

daniel-j-h opened this issue Apr 18, 2017 · 1 comment

Comments

@daniel-j-h
Copy link
Contributor

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

@akrzemi1
Copy link
Member

Indeed. The rvalue overloads are missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants