Skip to content

Commit

Permalink
make string fmt/ranges.h compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Jun 11, 2024
1 parent f18217f commit 259ee7f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions include/cista/containers/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,13 +534,21 @@ using string = basic_string<ptr<char const>>;
using string_view = basic_string_view<ptr<char const>>;
} // namespace offset

template <typename Ptr>
auto format_as(cista::basic_string<Ptr> const& s) {
return s.view();
}

} // namespace cista

#if __has_include("fmt/ostream.h")
#if __has_include("fmt/ranges.h")

#include "fmt/ostream.h"
#include "fmt/ranges.h"

template <typename Ptr>
struct fmt::formatter<cista::basic_string<Ptr>> : ostream_formatter {};
namespace fmt {
template <typename Ptr, typename Char>
struct range_format_kind<cista::basic_string<Ptr>, Char, void>
: std::false_type {};
} // namespace fmt

#endif

0 comments on commit 259ee7f

Please sign in to comment.