Skip to content

Commit

Permalink
Fix traceable template and format
Browse files Browse the repository at this point in the history
  • Loading branch information
yunimoo committed Aug 20, 2024
1 parent 6fda281 commit a291264
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions flow/include/flow/Traceable.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ struct Traceable : std::false_type {};
#define FORMAT_TRACEABLE(type, fmt) \
template <> \
struct Traceable<type> : std::true_type { \
static std::string toString(type value) { \
return format(fmt, value); \
} \
static std::string toString(type value) { return format(fmt, value); } \
}

FORMAT_TRACEABLE(bool, "%d");
Expand Down Expand Up @@ -175,15 +173,17 @@ struct TraceableString<char*> {
static std::string toString(char* value) { return std::string(value); }
};

template <>
struct TraceableString<std::filesystem::path> {
static std::string toString(const std::filesystem::path& value) {
return value.string();
}
};

template <class T>
struct TraceableStringImpl : std::true_type {
static constexpr bool isPrintable(char c) { return 32 <= c && c <= 126; }

template <class Str>
static std::string toString(std::filesystem::path& value) {
return value.string();
}

template <class Str>
static std::string toString(Str&& value) {
// if all characters are printable ascii, we simply return the string
Expand Down

0 comments on commit a291264

Please sign in to comment.