Namespaces
Variants

std::flat_map<Key,T,Compare,KeyContainer,MappedContainer>:: values

From cppreference.net

const mapped_container_type & values ( ) const noexcept ;
(C++23以降)

適応された値のコンテナへの定数参照を返します。次と等価です: return c. values ; .

目次

パラメータ

(なし)

戻り値

基になる値のコンテナ。

計算量

定数。

#include <flat_map>
#include <print>
#include <type_traits>
#include <vector>
int main()
{
    std::flat_map<int, double> map{{1, 1.1}, {2, 2.2}, {3, 3.3}};
    // デフォルトの値コンテナは std::vector:
    static_assert(std::is_same_v<decltype(map.values()), const std::vector<int>&>);
    std::println("{}", map.values());
}

出力:

[1.1, 2.2, 3.3]

関連項目

基になるキーコンテナへの直接アクセス
(公開メンバ関数)