You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if it's a bug (maybe it's expected behavior because of bool?), but if you define a custom data type with operator bool (regardless of return value) and operator <<, then formatting doesn't work.
Example code:
#include <iostream>
#include <string>
#include "cppformat/format.h"
struct Date {
operator bool() const { return true; }
friend
std::ostream& operator << (std::ostream& os, const Date& date) { return os << "1.1.1970"; }
};
int main() {
std::cout << "date is " << Date{} << "\n";
std::cout << fmt::format("date is {}\n", Date{}); // prints "date is 1"
}
The text was updated successfully, but these errors were encountered:
I think this has been fixed already in 6cff6d8. The commit message mentions enums but the same applies for any type implicitly convertible to int. Using the current master branch I get:
Not sure if it's a bug (maybe it's expected behavior because of
bool
?), but if you define a custom data type withoperator bool
(regardless of return value) andoperator <<
, then formatting doesn't work.Example code:
The text was updated successfully, but these errors were encountered: