[Tile-serving] [openstreetmap/osm2pgsql] fmtlib and C++20 (Issue #1704)

Jochen Topf notifications at github.com
Tue Jul 26 07:15:57 UTC 2022


We use [fmt](https://fmt.dev/) for formatting strings. Currently version 8.0.1 is vendored in. Newer versions 8.1.0 and 9.0.0 are available, but the syntax `""_format(...)` is deprecated in 8.1 and removed in 9.0. It can be added back with something like this in `format.hpp`:

```
inline constexpr auto operator"" _format(const char *s, std::size_t n)
{
    return [=](auto &&...args) {
#if FMT_VERSION < 80100
        return fmt::format(std::string_view{s, n}, args...);
#else
        return fmt::format(fmt::runtime(std::string_view{s, n}), args...);
#endif
    };
}
```

But this doesn't seem to work when compiling in C++20 mode. To be more exact, it does work locally for me, but not on Github Actions.
https://github.com/openstreetmap/osm2pgsql/actions/runs/2733557866

Related issues:
* https://github.com/fmtlib/fmt/issues/2640
* https://github.com/fmtlib/fmt/issues/2893

On the other hand: In C++20 we should be able to switch to `std::format`. But unless we write a compatibility layer, a solution that works everywhere is way off.

See also #1010.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/issues/1704
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/osm2pgsql/issues/1704 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20220726/a975f8a6/attachment.htm>


More information about the Tile-serving mailing list