A RetroSearch Logo

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

Search Query:

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

Support Incomplete Types, somehow · Issue #3180 · fmtlib/fmt · GitHub

Hi,

I'd like to come upwith a requirement to support the combination of fmt with incomplete types, that have been specialized in formatter.

To clarify the use case, an example might help

class IncompleteType;

namespace FmtHelper
{
  fmt::appender FormatTo(fmt::appender out, IncompleteType const&); // resides in linked code
};

namespace fmt
{
   template <typename charT> 
   struct formatter<IncompleteType, charT, void>
   {
        template <typename ctxT>
        constexpr auto parse(ctxT& ctx) -> decltype(ctx.begin())
        {
            return ctx.begin();
        }

        template <typename ctxT>
        constexpr auto format(IncompleteTypeconst& x, ctxT& ctx) noexcept
        {
            return FmtHelper::FormatTo(ctx.out(), x);
        }
   };
};

Rationale

Limitations

Currently

Workaround

godbolt: simulation


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