di 0.1.0
Loading...
Searching...
No Matches
integer.h
Go to the documentation of this file.
1#pragma once
2
5#include "di/meta/language.h"
6#include "di/types/prelude.h"
7
8namespace di::format {
9template<concepts::Integer T, concepts::Encoding Enc>
10requires(!concepts::OneOf<T, char, c32>)
12 return parse<detail::IntegerFormat>(parse_context.current_format_string()) % [](detail::IntegerFormat format) {
13 return [=](concepts::FormatContext auto& context, T value) -> Result<void> {
14 auto width = format.width.transform(&detail::Width::value);
15 return detail::present_integer_to<Enc>(context, format.fill_and_align, format.sign, format.hash_tag,
16 format.zero, width, format.type, false, value);
17 };
18 };
19}
20
21template<concepts::Encoding Enc>
23 return parse<detail::IntegerFormat>(parse_context.current_format_string()) % [](detail::IntegerFormat format) {
24 return [=](concepts::FormatContext auto& context, byte value) -> Result<void> {
25 auto width = format.width.transform(&detail::Width::value);
26 return detail::present_integer_to<Enc>(context, format.fill_and_align, format.sign, format.hash_tag,
27 format.zero, width, format.type, false, to_integer<u8>(value));
28 };
29 };
30}
31}
Definition format_parse_context.h:14
constexpr auto current_format_string() const -> View
Definition format_parse_context.h:191
Definition format_context.h:9
Definition bounded_format_context.h:7
di::meta::Decay< decltype(T)> Tag
Definition tag_invoke.h:28
Expected< T, Error > Result
Definition result.h:8
constexpr tag_invoke_detail::TagInvokeFn tag_invoke
Definition tag_invoke.h:22
constexpr auto parse
Definition parse.h:23
Definition in_place_type.h:5