mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-29 18:27:40 +02:00
fix: make std::bitset formattable again (#3660)
* fix: make std::bitset formattable again It used to be formattable via operator<<(ostream&) implicitly. Make it formattable again, but this time via formatter specialization. * fix: make nested_formatter constexpr default constructible
This commit is contained in:
committed by
GitHub
parent
f918289363
commit
f76603f21e
@ -237,6 +237,14 @@ TEST(std_test, format_const_bit_reference) {
|
||||
EXPECT_EQ(fmt::format("{} {}", v[0], v[1]), "true false");
|
||||
}
|
||||
|
||||
TEST(std_test, format_bitset) {
|
||||
const std::bitset<6> bs(42);
|
||||
EXPECT_EQ(fmt::format("{}", bs), "101010");
|
||||
EXPECT_EQ(fmt::format("{:.4}", bs), "101010");
|
||||
EXPECT_EQ(fmt::format("{:0>8}", bs), "00101010");
|
||||
EXPECT_EQ(fmt::format("{:-^12}", bs), "---101010---");
|
||||
}
|
||||
|
||||
TEST(std_test, format_atomic) {
|
||||
std::atomic<bool> b(false);
|
||||
EXPECT_EQ(fmt::format("{}", b), "false");
|
||||
|
Reference in New Issue
Block a user