Namespaces
Variants

std::indirect<T, Allocator>:: swap

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
constexpr void swap ( indirect & other ) noexcept ( /* 下記参照 */ ) ;
(C++26以降)

内容を other の内容と交換します。

以下の説明において、 swap_allocators std:: allocator_traits < Allocator > :: propagate_on_container_swap :: value を指します。

* this other の状態を交換し、所有するオブジェクトまたは無効状態を入れ替えます。

  • swap_allocators true の場合、 using std:: swap ;
    swap ( alloc  , other. alloc  ) ;
    を実行します。
  • それ以外の場合、アロケータは交換されません。

以下のいずれかの条件が満たされる場合、動作は未定義です:

  • swap_allocators true であり、かつ Allocator Swappable 要件を満たさない場合。
  • swap_allocators false であり、かつ get_allocator ( ) == other. get_allocator ( ) false である場合。

目次

翻訳の説明: - 「Contents」を「目次」に翻訳 - HTMLタグ、属性、クラス名はすべて保持 - C++関連の専門用語(Parameters、Exceptions、Example、See also)は翻訳せずに保持 - 数字やリンク構造は完全に保持 - フォーマットとインデントは元のまま維持

パラメータ

その他 - 内容を交換する indirect オブジェクト

例外

noexcept 仕様:
noexcept ( std:: allocator_traits < Allocator > :: propagate_on_container_swap :: value
|| std:: allocator_traits < Allocator > :: is_always_equal :: value )

関連項目

std::swap アルゴリズムを特殊化
(関数テンプレート)