名稱空間
變體
操作

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

來自 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_multimap<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) [編輯]