function
::node_handle::mapped(C++17)
mapped_type& mapped() const; // (1) C++17 : set コンテナには存在ない
constexpr mapped_type& mapped() const; // (1) C++26 : set コンテナには存在ない
概要
このノードハンドルによって管理されている map コンテナ要素の mapped_type メンバ(キーではない方)を指す参照を返す。
要件
empty() == false
戻り値
ptr_ が指す container_node_type オブジェクト内の value_type サブオブジェクトの mapped_type メンバへの参照。
例外
投げない。
例
#include <iostream>
#include <map>
#include <string>
int main()
{
std::map<int, std::string> m = {
{ 1, "nya" },
{ 2, "nyan" },
{ 3, "nyau" }
};
auto nh = m.extract(m.begin());
std::cout << nh.mapped();
}
出力
nya
バージョン
言語
- C++17
処理系
- Clang: 7.0.0 ✅
- GCC: 7.1.0 ✅
- ICC: ??
- Visual C++: 2017 Update 5 ✅