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

Format a single value repeated a fixed number of times. More...

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

Go to the source code of this file.

Classes

struct  microfmt::repeated_view< T >
 
struct  microfmt::formatter< repeated_view< T > >
 

Namespaces

namespace  microfmt
 

Functions

template<typename T >
constexpr auto microfmt::repeat (T value, size_t count) noexcept
 
template<typename T >
constexpr auto microfmt::repeat (T value, size_t count, microfmt::string_view separator) noexcept
 

Detailed Description

Format a single value repeated a fixed number of times.

Use microfmt::repeat to wrap any formattable value together with a repeat count and an optional separator. The view stores the value by decayed copy without allocation and formats it count times, writing the separator between consecutive repetitions. The complete replacement-field specifier is forwarded to the wrapped value's formatter on every repetition.