Closed Spongman closed 1 year ago
The addition of:
using date::operator<<;
should clear up the problem.
thanks, that works. but how come I don't need using std::string::operator<<;
to use that?
std::string::operator<<
works without this treatment because std::string
and its operator<<
are both in namespace std
. Something called "argument dependent lookup" searches namespace std because that namespace is associated with string
.
Only namespace std::chrono
is associated with the time_point
returned from system_clock::now()
. And I couldn't put it's operator<<
in namespace std::chrono
in this library. Instead I had to put it in namespace date
. And namespace date
isn't searched by "argument dependent lookup".
In C++20, the operator<<
will be in namespace std::chrono
along with the time_point
. So this weirdness will disappear (once all std::lib vendors implement it).
thanks for the great explanation!
22ceabf