名前空間
変種
操作

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

From cppreference.com
 
 
 
 
const key_container_type& keys() const noexcept;
(C++23から)

アダプターキーコンテナへの定数参照を返します。 return c.keys; と同等です。

目次

[編集] パラメータ

(なし)

[編集] 戻り値

基底となるキーコンテナ。

[編集] 計算量

定数。

[編集]

#include <flat_map>
#include <print>
#include <type_traits>
#include <vector>
 
int main()
{
    std::flat_map<int, double> adaptor{{1, 1.1}, {2, 2.2}, {3, 3.3}};
 
    // The default keys container is std::vector:
    static_assert(std::is_same_v<decltype(adaptor.keys()), const std::vector<int>&>);
 
    std::println("{}", adaptor.keys());
}

出力

[1, 2, 3]

[編集] 関連項目

基底値コンテナへの直接アクセス
(public member function) [編集]
English 日本語 中文(简体) 中文(繁體)