|
7941 | 7941 | deleter, but properly disposes of its owned object via the associated
|
7942 | 7942 | deleter before such replacement is considered completed.
|
7943 | 7943 |
|
7944 |
| -\pnum |
7945 |
| -Additionally, \textit{u} can, upon request, \defn{transfer ownership} to another |
7946 |
| -unique pointer \textit{u2}. Upon completion of such a transfer, the following |
7947 |
| -postconditions hold: |
7948 |
| - |
7949 |
| -\begin{itemize} |
7950 |
| -\item \textit{u2.p} is equal to the pre-transfer \textit{u.p}, |
7951 |
| -\item \textit{u.p} is equal to \tcode{nullptr}, and |
7952 |
| -\item if the pre-transfer \textit{u.d} maintained state, such state has been |
7953 |
| -transferred to \textit{u2.d}. |
7954 |
| -\end{itemize} |
7955 |
| - |
7956 |
| -As in the case of a reset, \textit{u2} properly disposes of its pre-transfer |
7957 |
| -owned object via the pre-transfer associated deleter before the ownership |
7958 |
| -transfer is considered complete. \begin{note} A deleter's state need never be |
7959 |
| -copied, only moved or swapped as ownership is transferred. \end{note} |
7960 |
| - |
7961 | 7944 | \pnum
|
7962 | 7945 | Each object of a type \tcode{U} instantiated from the \tcode{unique_ptr} template
|
7963 | 7946 | specified in this subclause has the strict ownership semantics, specified above,
|
|
8297 | 8280 | throw an exception.
|
8298 | 8281 |
|
8299 | 8282 | \pnum
|
8300 |
| -\effects Constructs a \tcode{unique_ptr} by transferring ownership from |
8301 |
| -\tcode{u} to \tcode{*this}. If \tcode{D} is a reference type, this |
| 8283 | +\effects Constructs a \tcode{unique_ptr} from |
| 8284 | +\tcode{u}. If \tcode{D} is a reference type, this |
8302 | 8285 | deleter is copy constructed from \tcode{u}'s deleter; otherwise, this
|
8303 | 8286 | deleter is move constructed from \tcode{u}'s deleter. \begin{note} The
|
8304 |
| -deleter constructor can be implemented with \tcode{std::forward<D>}. \end{note} |
| 8287 | +construction of the deleter can be implemented with \tcode{std::forward<D>}. \end{note} |
8305 | 8288 |
|
8306 | 8289 | \pnum
|
8307 | 8290 | \postconditions \tcode{get()} yields the value \tcode{u.get()}
|
8308 |
| -yielded before the construction. \tcode{get_deleter()} returns a reference |
| 8291 | +yielded before the construction. \tcode{u.get() == nullptr}. |
| 8292 | +\tcode{get_deleter()} returns a reference |
8309 | 8293 | to the stored deleter that was constructed from
|
8310 | 8294 | \tcode{u.get_deleter()}. If \tcode{D} is a reference type then
|
8311 | 8295 | \tcode{get_deleter()} and \tcode{u.get_deleter()} both reference
|
|
8336 | 8320 | \end{itemize}
|
8337 | 8321 |
|
8338 | 8322 | \pnum
|
8339 |
| -\effects Constructs a \tcode{unique_ptr} by transferring ownership from \tcode{u} |
8340 |
| -to \tcode{*this}. If \tcode{E} is a reference type, this deleter is copy constructed from |
| 8323 | +\effects Constructs a \tcode{unique_ptr} from \tcode{u}. |
| 8324 | +If \tcode{E} is a reference type, this deleter is copy constructed from |
8341 | 8325 | \tcode{u}'s deleter; otherwise, this deleter is move constructed from \tcode{u}'s
|
8342 | 8326 | deleter. \begin{note} The deleter constructor can be implemented with
|
8343 | 8327 | \tcode{std::forward<E>}. \end{note}
|
8344 | 8328 |
|
8345 | 8329 | \pnum
|
8346 | 8330 | \postconditions \tcode{get()} yields the value \tcode{u.get()}
|
8347 |
| -yielded before the construction. |
| 8331 | +yielded before the construction. \tcode{u.get() == nullptr}. |
8348 | 8332 | \tcode{get_deleter()} returns a reference
|
8349 | 8333 | to the stored deleter that was constructed from
|
8350 | 8334 | \tcode{u.get_deleter()}.
|
|
8387 | 8371 | lvalue of type \tcode{D} shall not throw an exception.
|
8388 | 8372 |
|
8389 | 8373 | \pnum
|
8390 |
| -\effects |
8391 |
| -Transfers ownership from \tcode{u} to \tcode{*this} as if by calling |
8392 |
| -\tcode{reset(u.release())} followed by |
8393 |
| -\tcode{get_deleter() = std::forward<D>(u.get_deleter())}. |
| 8374 | +\effects Calls \tcode{reset(u.release())} followed by |
| 8375 | +\tcode{get_deleter() = std::forward<D>(u.get_dele\-ter())}. |
8394 | 8376 |
|
8395 | 8377 | \pnum
|
8396 | 8378 | \returns \tcode{*this}.
|
| 8379 | + |
| 8380 | +\pnum |
| 8381 | +\postconditions \tcode{u.get() == nullptr}. |
8397 | 8382 | \end{itemdescr}
|
8398 | 8383 |
|
8399 | 8384 | \indexlibrarymember{operator=}{unique_ptr}%
|
|
8418 | 8403 | \end{itemize}
|
8419 | 8404 |
|
8420 | 8405 | \pnum
|
8421 |
| -\effects Transfers ownership from \tcode{u} to \tcode{*this} as if by calling |
8422 |
| -\tcode{reset(u.release())} followed by |
8423 |
| -\tcode{get_deleter() = std::forward<E>(u.get_deleter())}. |
| 8406 | +\effects Calls \tcode{reset(u.release())} followed by |
| 8407 | +\tcode{get_deleter() = std::forward<E>(u.get_dele\-ter())}. |
8424 | 8408 |
|
8425 | 8409 | \pnum
|
8426 | 8410 | \returns \tcode{*this}.
|
| 8411 | + |
| 8412 | +\pnum |
| 8413 | +\postconditions \tcode{u.get() == nullptr}. |
8427 | 8414 | \end{itemdescr}
|
8428 | 8415 |
|
8429 | 8416 | \indexlibrarymember{operator=}{unique_ptr}%
|
|
0 commit comments