Skip to content

Commit

Permalink
add fmt support if fmt/ostream.h is found
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Feb 22, 2024
1 parent 79af417 commit 49090f7
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/cista/containers/bitset.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,12 @@ struct bitset {
};

} // namespace cista

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

#include "fmt/ostream.h"

template <std::size_t Size>
struct fmt::formatter<cista::bitset<Size>> : ostream_formatter {};

#endif
9 changes: 9 additions & 0 deletions include/cista/containers/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,3 +444,12 @@ using string_view = basic_string_view<ptr<char const>>;
} // namespace offset

} // namespace cista

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

#include "fmt/ostream.h"

template <typename Ptr>
struct fmt::formatter<cista::basic_string<Ptr>> : ostream_formatter {};

#endif
9 changes: 9 additions & 0 deletions include/cista/indexed.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@ template <class T>
constexpr bool is_indexed_v = is_indexed_helper<std::remove_cv_t<T>>::value;

} // namespace cista

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

#include "fmt/ostream.h"

template <typename T>
struct fmt::formatter<cista::indexed<T>> : ostream_formatter {};

#endif
9 changes: 9 additions & 0 deletions include/cista/strong.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,12 @@ struct hash<cista::strong<T, Tag>> {
};

} // namespace std

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

#include "fmt/ostream.h"

template <typename T, typename Tag>
struct fmt::formatter<cista::strong<T, Tag>> : ostream_formatter {};

#endif

0 comments on commit 49090f7

Please sign in to comment.