Skip to content

[WIP] Add support for customizable formatting - #933

Open
tmadlener wants to merge 30 commits into
AIDASoft:masterfrom
tmadlener:customizable-formatting
Open

[WIP] Add support for customizable formatting#933
tmadlener wants to merge 30 commits into
AIDASoft:masterfrom
tmadlener:customizable-formatting

Conversation

@tmadlener

Copy link
Copy Markdown
Collaborator

BEGINRELEASENOTES

  • Make it possible to specify a user defined formatting via the {u} specifier.

ENDRELEASENOTES

This follows roughly the approach outlined in #920 (comment) and is the final piece of the chain towards customizable collection formatting.

As a first step using the ostream_formatter adaptor to re-use the
existing operator<<.
Implement the existing operator<< in terms of format_to
Necessary to ensure that things still compile if fmt/ranges.h is
included to avoid ambiguities that would otherwise arise because LinkT
behaves tuple-like enough to trigger tuple formatting. Collections are
ranges so we have to explicitly opt-out.
Also get rid of some hideous string concatenation while we are at it
Make the default try the user defined and fall back to the generated one
@tmadlener
tmadlener force-pushed the customizable-formatting branch from ea428e7 to 5829013 Compare August 26, 2026 14:51
@tmadlener

Copy link
Copy Markdown
Collaborator Author

I suppose one of the biggest questions here is whether we are OK with making fmt a hard dependency of podio for now or whether we should invest time into making a compatibility layer that switches to std::format under the hood if possible / supported by the compiler. All of this should also be possible on top of std::format, but there is no mixing & matching between the two libraries, they seem to be mutually exclusive.

The other option is to only have this functionality present in case the compiler has enough std::format support, which would put a rather high floor on the compilers. I think for most of the things we would need at least gcc15 (not sure about clang). However, that would probably also mean that we have to maintain dedicated / gated operator<< implementations for the builds without std::format support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant