Assignable wrapper (C++20)
Min standard notice:
ranges::single_view, ranges::repeat_view,(since C++23) and range adaptors that store an invocable object are specified in terms of an exposition-only class template copyable-box(until C++23)movable-box(since C++23). The name shown here is for exposition purposes only.
# Declarations
template< class T >
requires std::copy_constructible<T> && std::is_object_v<T>
class /*copyable-box*/;
(since C++20) (until C++23) (exposition only*)
template< class T >
requires std::move_constructible<T> && std::is_object_v<T>
class /*movable-box*/;
(since C++23) (exposition only*)
# Notes
A copyable-box(until C++23)movable-box(since C++23) does not contain a value only if
Before P2325R3, the wrapper was called semiregular-box in the standard and always satisfied semiregular, as the default constructor was always provided (which might construct a valueless wrapper).
# Defect reports
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| P2325R3 | C++20 | if T is not default_initializable, the default constructorconstructs a wrapper which does not contain a value | the wrapper is alsonot default_initializable |
| LWG 3572 | C++20 | conditionally different assignment operators were not constexpr | made constexpr |
# See also
- ranges::single_viewviews::single
- view
- ranges::repeat_viewviews::repeat
- view
- ranges::filter_viewviews::filter
- view
- range
- ranges::transform_viewviews::transform
- view
- ranges::take_while_viewviews::take_while
- view
- view
- ranges::drop_while_viewviews::drop_while
- view
- view
- ranges::zip_transform_viewviews::zip_transform
- view
- ranges::adjacent_transform_viewviews::adjacent_transform
- view