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

Create an exposition-only helper for the std::optional copy/move ctor constraints #5205

Closed
jwakely opened this issue Jan 14, 2022 · 0 comments · Fixed by #5416
Closed

Create an exposition-only helper for the std::optional copy/move ctor constraints #5205

jwakely opened this issue Jan 14, 2022 · 0 comments · Fixed by #5416
Assignees

Comments

@jwakely
Copy link
Member

jwakely commented Jan 14, 2022

In [optional.ctor] optional(const optional&) has:

Constraints:

  • is_­constructible_­v<T, const U&> is true,
  • is_­constructible_­v<T, optional<U>&> is false,
  • is_­constructible_­v<T, optional<U>&&> is false,
  • is_­constructible_­v<T, const optional<U>&> is false,
  • is_­constructible_­v<T, const optional<U>&&> is false,
  • is_­convertible_­v<optional<U>&, T> is false,
  • is_­convertible_­v<optional<U>&&, T> is false,
  • is_­convertible_­v<const optional<U>&, T> is false, and
  • is_­convertible_­v<const optional<U>&&, T> is false.

Then we do the same thing for optional(optional&&), only varying the first bullet.

We're also adding more of this in the std::expected paper, so something like an exposition-only variable template that could be used repeatedly would be good.

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

Successfully merging a pull request may close this issue.

1 participant