A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/fmtlib/fmt/issues/4226 below:

Extend tuple features (e.g. join) to tuple-like objects · Issue #4226 · fmtlib/fmt · GitHub

For some technical reasons I had to replicate the functionality of std::tuple in my library. (see here: https://github.com/correaa/boost-multi?tab=readme-ov-file#formatting-fmt-pretty-printing)

I would be nice that the features in fmt would work on any type that has std::get<N>, std::tuple_size, etc. in their interface.
That is, if a type is tuple like then it could be printed as a tuple.

(This will also work on any class for which structured binding is implemented).

int main() {

    std::tuple<int, int> t1(1, 2);
    fmt::print( "{}", fmt::join(t1, "x") );  // prints 1 x 2

    my_tuple<int, int> t2(1, 2);
    fmt::print( "{}", fmt::join(t2, "x") );  // doesn't work now
}

Here it is a godbolt example:

https://godbolt.org/z/Gof6f4oaE


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4