-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Const and static version for FMT_VARIADIC #589
Comments
No but it's easy to write them. PRs are welcome =). If you don't need C++98 support, then I recommend using variadic templates directly instead of |
Thanks for the reply. FMT_VARIADIC is currently better way for me although I don't need C++98. The reason is that I can keep method implementation in cpp file and I don't have to move it to header files as the template. Regarding PR, I will try to implement it, but I'm not sure if I will be able to. |
You'll be able to do the same in the next version (currently // The main formatting function - not a template and can't be defined elsewhere:
std::string vformat(string_view format_str, fmt::args args);
template <typename... Args>
inline std::string format(string_view format_str, const Args & ... args) {
return vformat(format_str, fmt::make_args(args...));
}
|
I understand that the main reason for FMT_VARIADIC is C++98 compatability. But I think that this macro also helps with better readability and faster development. It's much easier (and resistant to errors) to write FMT_VARIADIC(...) than writing full variadic template each time. Because of that, it would be great if you will keep this template also after removing C++98 compatibility. On the other side, it's easy to define such macro in my project in case you will decide to remove it. |
Tried to implement FMT_VARIADIC_CONST as discussed. Hope it's ok (including test in format-test.cc) |
Is there any static and const version for FMT_VARIADIC macro?
Static can be "simulated" by passing static to first param:
FMT_VARIADIC(static void, Write, const char *);
but I didn't find a way how to use FMT_VARIADIC for const method.
Thanks
PS: In all other aspects it's a perfect library. Thanks!
The text was updated successfully, but these errors were encountered: