[range.move.wrap] # 25 Ranges library [[ranges]](./#ranges) ## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.move.wrap) ### 25.7.3 Movable wrapper [range.move.wrap] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L4308) Many types in this subclause are specified in terms of an exposition-only class template *movable-box*[.](#1.sentence-1) *movable-box* behaves exactly like optional with the following differences: - [(1.1)](#1.1) *movable-box* constrains its type parameter T with[move_constructible](concept.moveconstructible#concept:move_constructible "18.4.13 Concept move_­constructible [concept.moveconstructible]") && is_object_v. - [(1.2)](#1.2) The default constructor of *movable-box* is equivalent to:constexpr *movable-box*() noexcept(is_nothrow_default_constructible_v)requires [default_initializable](concept.default.init#concept:default_initializable "18.4.12 Concept default_­initializable [concept.default.init]"): *movable-box*{in_place} {} - [(1.3)](#1.3) If [copyable](concepts.object#concept:copyable "18.6 Object concepts [concepts.object]") is not modeled, the copy assignment operator is equivalent to:constexpr *movable-box*& operator=(const *movable-box*& that)noexcept(is_nothrow_copy_constructible_v)requires [copy_constructible](concept.copyconstructible#concept:copy_constructible "18.4.14 Concept copy_­constructible [concept.copyconstructible]") {if (this != addressof(that)) {if (that) emplace(*that); else reset(); }return *this;} - [(1.4)](#1.4) If [movable](concepts.object#concept:movable "18.6 Object concepts [concepts.object]") is not modeled, the move assignment operator is equivalent to:constexpr *movable-box*& operator=(*movable-box*&& that)noexcept(is_nothrow_move_constructible_v) {if (this != addressof(that)) {if (that) emplace(std::move(*that)); else reset(); }return *this;} [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L4354) *Recommended practice*: - [(2.1)](#2.1) If [copy_constructible](concept.copyconstructible#concept:copy_constructible "18.4.14 Concept copy_­constructible [concept.copyconstructible]") is true,*movable-box* should store only a T if either T models [copyable](concepts.object#concept:copyable "18.6 Object concepts [concepts.object]"), oris_nothrow_move_constructible_v && is_nothrow_copy_constructible_v is true[.](#2.1.sentence-1) - [(2.2)](#2.2) Otherwise, *movable-box* should store only a T if either T models [movable](concepts.object#concept:movable "18.6 Object concepts [concepts.object]") oris_nothrow_move_constructible_v is true[.](#2.2.sentence-1)