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
I am currently implementing an fmt-based formatter for the Eigen library since the original one uses ostreams and requires to build a formatter object to change the formatting.
The initial implementation is working and the first tests gives a 4x performance boost, which is great. However I am struggling with one issue and I can't find in the docs how to solve it.
Since my format string can be quite long (lot of parameters) I'd like to be able to construct it once and then pass it as an additional argument to the format function, similar to what is possible for floating point numbers precision (fmt::format("{:.{}f}", 3.14, 1);)
But I don't understand how to make it works. Do I have to do something specific in my formatter parse function to tell fmt that there is a {} that need to be formatted or do I have to, somehow, access myself the next argument and handle it myself?
The text was updated successfully, but these errors were encountered:
Thanks a lot for your help. I had to stick with C++11 so it was a bit challenging to rewrite your example for that and handle everything properly but I did it. Here is my result if someone is in the same situation as I am and need an example
I am currently implementing an fmt-based formatter for the Eigen library since the original one uses ostreams and requires to build a formatter object to change the formatting.
The initial implementation is working and the first tests gives a 4x performance boost, which is great. However I am struggling with one issue and I can't find in the docs how to solve it.
Since my format string can be quite long (lot of parameters) I'd like to be able to construct it once and then pass it as an additional argument to the format function, similar to what is possible for floating point numbers precision (
fmt::format("{:.{}f}", 3.14, 1);
)In my case I'd like to do:
But I don't understand how to make it works. Do I have to do something specific in my formatter parse function to tell fmt that there is a
{}
that need to be formatted or do I have to, somehow, access myself the next argument and handle it myself?The text was updated successfully, but these errors were encountered: