-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug/Display for numeric types #230
Comments
Adding support for fmtlib here: #244 There is so much to re-implement for display and fmt is high quality and widely used. I think it's the right path, so adding support for formatting of each type. I need to look further into:
|
There is no debug vs display differentiation in fmtlib. We could add to parse() to look for a |
subspace/string/compat_stream.h will allow streaming of any (public) subspace type that is formattable. |
For some reason the stream operator is not being picked up and used by GTest's ADL mechanisms on MSVC and it's breaking my brain. The decltype stuff for SFINAE all resolves when I reproduce it myself. Not sure if this is a blocker issue or what. OK it was caching problems due to one TU seeing the operator<< template and one TU not, and compilers cacheing the first resulting GTest template for that type. Resolved by putting the operator<< template in prelude.h which it can do with just iosfwd. Since we have operator<< there is no need for PrintTo. |
I think #244 is sufficient to close this issue. |
We need to be able to print numerics without casting them to primitives every time.
Some basic options exist:
Modeling Debug/Display traits as concepts instead we can do it differently, but something like (2) or (3) above.
This version will look up write_debug() through ADL:
It can be implemented as a friend function:
Or a free function:
This version will look for the method on the class. It can't be added types you don't control.
And the method has to clutter the type's public API, even though it should not be called directly.
I think we should go with the first option.
Then we have two more choices:
As there's much to be done for how the Formatter would work, the Formatter should not be stabilized along with numeric types, but the use of them through PrintTo() or << depending on the above, is fine.
The text was updated successfully, but these errors were encountered: