std::flat_map::keys(3)
β¨ NAME β¨
okay so this page is std::flat_map::keys β literally std::flat_map::keys β from the C++ Standard Libary manual, and itβs here to hand you the keys container, bestie. π
πΈ Synopsis πΈ
const key_container_type& keys() const noexcept; (since C++23)
Return a constant reference to the adapted keys container. Equivalent to return c.keys;. β¨
π Parameters π
(none) β no params, no stress, we love that for us. π«Ά
π Return value π
The underlying keys container. Thatβs the whole vibe. π
π₯ Complexity π₯
Constant. periodt. β
π¦ Example π¦
Run this code π
#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());
}
Output π¬
[1, 2, 3]
π See also π
valuesβ direct access to the underlying values container (public member function). π
made with π from http://cppreference.com, version/date 2024.06.10, on the std::flat_map::keys(3) page β byeee π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms