Skip to content

Latest commit

 

History

History
68 lines (50 loc) · 1.49 KB

File metadata and controls

68 lines (50 loc) · 1.49 KB

mapped

  • cpp17[meta cpp]
  • node_handle[meta category]
  • node_handle[meta class]
  • function[meta id-type]
  • [meta namespace]
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();
}
  • mapped[color ff0000]

出力

nya

バージョン

言語

  • C++17

処理系

  • Clang: 7.0.0 [mark verified]
  • GCC: 7.1.0 [mark verified]
  • ICC: ??
  • Visual C++: 2017 Update 5 [mark verified]

参照