Skip to content

[swappable.requirements] Requires should now be Preconditions #4886

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

Merged
merged 3 commits into from
Sep 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions source/lib-intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1612,17 +1612,18 @@
User code can ensure that the evaluation of \tcode{swap} calls
is performed in an appropriate context under the various conditions as follows:
\begin{codeblock}
#include <cassert>
#include <utility>

// Requires: \tcode{std::forward<T>(t)} shall be swappable with \tcode{std::forward<U>(u)}.
// Preconditions: \tcode{std::forward<T>(t)} is swappable with \tcode{std::forward<U>(u)}.
template<class T, class U>
void value_swap(T&& t, U&& u) {
using std::swap;
swap(std::forward<T>(t), std::forward<U>(u)); // OK: uses ``swappable with'' conditions
// for rvalues and lvalues
}

// Requires: lvalues of \tcode{T} shall be swappable.
// Preconditions: lvalues of \tcode{T} are swappable.
template<class T>
void lv_swap(T& t1, T& t2) {
using std::swap;
Expand Down