std::experimental::propagate_const<T>::swap
From cppreference.com
< cpp | experimental | propagate const
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Experimental
Filesystem library (filesystem TS)
Library fundamentals (library fundamentals TS)
Library fundamentals 2 (library fundamentals TS v2)
Library fundamentals 3 (library fundamentals TS v3)
Extensions for parallelism (parallelism TS)
Extensions for parallelism 2 (parallelism TS v2)
Extensions for concurrency (concurrency TS)
Extensions for concurrency 2 (concurrency TS v2)
Concepts (concepts TS)
Ranges (ranges TS)
Reflection (reflection TS)
Mathematical special functions (special functions TR)
std::experimental::propagate_const
Member functions
propagate_const::swap
Observers
Non-member functions
Helper classes
constexpr void swap( propagate_const & pt ) noexcept(/* see below */);
(library fundamentals TS v2)
Swaps the wrapped pointer with that of pt. Let t_
designate the private data member that is the wrapped pointer-like object, then this function is equivalent to swap(t_, pt.t_), where the overload resolution for swap
is performed among std::swap and any declaration found by the usual lookup rules, as described in Swappable.
The behavior is undefined if lvalues of T
do not satisfy Swappable.
[edit] Parameters
pt
-
another
propagate_const
object to swap with
[edit] Exceptions
noexcept specification:
The lookup for the identifier noexcept(noexcept(swap(t_, pt.t_)))
swap
in the exception specification finds overloads described above, and does not find the member function itself, making the exception specification equivalent to C++17 std::is_nothrow_swappable .
(library fundamentals TS v2)noexcept specification:
(library fundamentals TS v3)noexcept(std::is_nothrow_swappable_v <T>)
[edit] Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR | Applied to | Behavior as published | Correct behavior |
---|---|---|---|
LWG 3413 | LFTSv2 | the exception specification was ill-formed | made well-formed |