|
microfmt
Zero-allocation C++ formatting for constrained environments
|
Format only the elements of a range that satisfy a predicate. More...
#include "../microfmt.hpp"#include <cstddef>#include <iterator>#include <string_view>#include <type_traits>#include <utility>
Go to the source code of this file.
Namespaces | |
| namespace | microfmt |
Functions | |
| template<typename Range , typename Predicate > | |
| constexpr auto | microfmt::filter (const Range &rng, Predicate &&pred) noexcept |
| template<typename Range , typename Predicate , std::enable_if_t<!std::is_lvalue_reference_v< Range >, int > = 0> | |
| constexpr auto | microfmt::filter (Range &&, Predicate &&) noexcept=delete |
| template<typename T , typename Predicate > | |
| constexpr auto | microfmt::filter (const T *ptr, size_t count, Predicate &&pred) noexcept |
Format only the elements of a range that satisfy a predicate.
Use microfmt::filter with an iterable range or a raw pointer and count. The view stores the predicate without allocation and evaluates it as output is formatted. Use b, c, or n to select square brackets, braces, or no outer delimiters; the remaining specifier is forwarded to each matching element.