mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-07 13:20:05 +00:00
Add std:🧵:id formatter
This commit is contained in:
parent
9730fb0156
commit
6bf039d750
@ -8,7 +8,9 @@
|
||||
#ifndef FMT_STD_H_
|
||||
#define FMT_STD_H_
|
||||
|
||||
#include "format.h"
|
||||
#include <thread>
|
||||
|
||||
#include "ostream.h"
|
||||
|
||||
#if FMT_HAS_INCLUDE(<version>)
|
||||
# include <version>
|
||||
@ -27,4 +29,8 @@ struct fmt::formatter<std::filesystem::path> : formatter<string_view> {
|
||||
};
|
||||
#endif
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
template <> struct formatter<std::thread::id> : ostream_formatter {};
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#endif // FMT_STD_H_
|
||||
|
@ -14,3 +14,7 @@ TEST(std_test, path) {
|
||||
EXPECT_EQ(fmt::format("{:8}", std::filesystem::path("foo")), "foo ");
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(std_test, thread_id) {
|
||||
EXPECT_FALSE(fmt::format("{}", std::this_thread::get_id()).empty());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user