Skip to content
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

Don't explicitly delete copy ctor of dynamic_format_arg_store #2664

Merged
merged 3 commits into from
Dec 23, 2021

Conversation

lucpelletier
Copy link
Contributor

Explicitly deleting the copy ctor causes the move constructor to not be
implicitly generated. This behaviour is different than what was in
v8.0.1 and causes code that relied on the move ctor of
dynamic_format_arg_store to break.

Explicitly deleting the copy ctor causes the move constructor to not be
implicitly generated. This behaviour is different than what was in
v8.0.1 and causes code that relied on the move ctor of
dynamic_format_arg_store to break.
@vitaut
Copy link
Contributor

vitaut commented Dec 18, 2021

Thanks for the PR. Could you elaborate why you need a move ctor?

@lucpelletier
Copy link
Contributor Author

Yes, of course. I want to use Quill, which is a low-latency asynchronous logging library that uses fmtlib. The following class has a member of type dynamic_format_arg_store, and needs to support move operations:

https://github.com/odygrd/quill/blob/1386bff42eea9411600e58b9ddd682f1ec685c5a/quill/include/quill/detail/backend/BackendWorker.h#L211

Copy link
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense but please add a unit test for the move ctor in https://github.com/fmtlib/fmt/blob/master/test/args-test.cc.

@lucpelletier
Copy link
Contributor Author

Added test for move ctor. Did you also want a test for move assignment?

const char* const test_c_string = "foo";

auto store_uptr =
std::make_unique<fmt::dynamic_format_arg_store<fmt::format_context>>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::make_unique - C++14+

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@vitaut vitaut merged commit 7812813 into fmtlib:master Dec 23, 2021
@vitaut
Copy link
Contributor

vitaut commented Dec 23, 2021

Thank you

@lucpelletier lucpelletier deleted the fix branch December 24, 2021 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants