microfmt
Zero-allocation C++ formatting for constrained environments
Loading...
Searching...
No Matches
Classes | Namespaces | Typedefs | Functions
map_view.hpp File Reference

Format map-like ranges with zero-allocation key and value views. More...

#include "../microfmt.hpp"
#include <cstddef>
#include <string_view>
#include <type_traits>
#include <utility>
Include dependency graph for map_view.hpp:

Go to the source code of this file.

Classes

struct  microfmt::map_range_view< KeyExtractor, ValExtractor, Iterator, Sentinel >
 
struct  microfmt::detail::has_first_member< T, typename >
 
struct  microfmt::detail::has_first_member< T, std::void_t< decltype(std::declval< const T & >().first)> >
 
struct  microfmt::detail::has_second_member< T, typename >
 
struct  microfmt::detail::has_second_member< T, std::void_t< decltype(std::declval< const T & >().second)> >
 
struct  microfmt::detail::has_key_method< T, typename >
 
struct  microfmt::detail::has_key_method< T, std::void_t< decltype(std::declval< const T & >().key())> >
 
struct  microfmt::detail::has_value_method< T, typename >
 
struct  microfmt::detail::has_value_method< T, std::void_t< decltype(std::declval< const T & >().value())> >
 
struct  microfmt::detail::is_dereferenceable< T, typename >
 
struct  microfmt::detail::is_dereferenceable< T, std::void_t< decltype(*std::declval< T & >())> >
 
struct  microfmt::default_key_fn
 
struct  microfmt::default_val_fn
 
struct  microfmt::formatter< map_range_view< KeyExtractor, ValExtractor, Iterator, Sentinel > >
 

Namespaces

namespace  microfmt
 
namespace  microfmt::detail
 

Typedefs

template<typename T >
using microfmt::detail::remove_cvref_map_t = typename std::remove_cv< typename std::remove_reference< T >::type >::type
 

Functions

template<typename MapContainer >
constexpr auto microfmt::map_view (const MapContainer &m) noexcept
 
template<typename MapContainer , std::enable_if_t<!std::is_lvalue_reference_v< MapContainer >, int > = 0>
constexpr auto microfmt::map_view (MapContainer &&) noexcept=delete
 
template<typename MapContainer , typename KeyFn , typename ValFn >
constexpr auto microfmt::map_view (const MapContainer &m, KeyFn &&kfn, ValFn &&vfn) noexcept
 
template<typename MapContainer , typename KeyFn , typename ValFn , std::enable_if_t<!std::is_lvalue_reference_v< MapContainer >, int > = 0>
constexpr auto microfmt::map_view (MapContainer &&, KeyFn &&, ValFn &&) noexcept=delete
 
template<typename Iterator , typename Sentinel , typename KeyFn = default_key_fn, typename ValFn = default_val_fn, typename std::enable_if< detail::is_dereferenceable< Iterator >::value, int >::type = 0>
constexpr auto microfmt::map_view (Iterator first, Sentinel last, KeyFn &&kfn=KeyFn{}, ValFn &&vfn=ValFn{}) noexcept
 

Detailed Description

Format map-like ranges with zero-allocation key and value views.

Use microfmt::map_view with standard map containers, iterator ranges, or custom key/value extractors for intrusive and flat containers. Default formatting renders {key: value} entries. Use b, c, or n to select brackets, braces, or no outer delimiters; remaining format characters are forwarded to both keys and values.