-
Notifications
You must be signed in to change notification settings - Fork 158
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
Should copy_loggable be enabled by default for all trivially copyable types? #318
Comments
I think we can probably add it, at the moment it is only checking for trivial types https://github.com/odygrd/quill/blob/master/quill/include/quill/detail/misc/TypeTraitsCopyable.h#L314C38-L314C52 Do you have an example of a type that it happened ? |
One example is a TimeDelta type, which represents the difference between two points in time (it's in some older code that predates std::chrono). It has quite a few different constructors, but no virtual methods and the only data member is an int64_t. It is trivially copyable (std::is_trivially_copyable_v == true). I've just gotten started converting this codebase to use quill and fmtlib, but I have quite a few other such types as well. It's automated trading stuff so I also have things like Quote, Offer, Price, Order, all of which are trivially copyable POD types. |
I have done this in b34c828 |
Thanks! No release needed, I can get it from the master branch |
Thanks, let me know if you come across any other issues :) |
In other words, should the default implementation of copy_loggable look like this:
I find that often when I need to mark a type as copy_loggable, it's already trivially copyable, and it seems like that ought to be the appropriate default for copy_loggable. But since I'm no language lawyer I doubt that I understand all the possible implications of this change.
The text was updated successfully, but these errors were encountered: