Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Modified dispatcher.h to use uncopyable
inplace_function
s. This required some significant modification to the uncopyable features added toinplace_function
previously, as that implementation had some serious flaws. In particular, while the implementation prevented copying and prevented the copy constructor from existing, it didn't actually delete the copy constructor. This meant that code which was simply looking to see whether uncopyableinplace_function
s had a copy constructor -- notablystd::is_copy_constructible
-- to see that the copy constructor still existed and to conclude, therefore, that the type was copyable. This caused problems when it led MSVC's implementation of certain STL containers to elect to copy rather than move, only to fail when the copy constructor turned out to be unusable.To solve this problem, the copy constructor needed to be deleted, not merely unusable; and to do that, the uncopyable version of the
inplace_function
needed to be a specialization of the entire type, not just of specific functions. Thus,inplace_function.h
now contains twoinplace_function
specializations, one copyable and one not, with the shared behavior factored out as much as possible into a separateimpl
. With this change,std::is_copy_constructible
is able to correctly determine the copyability ofinplace_function
s, leading MSVC's STL to make the right decisions and allowing us to use uncopyableinplace_function
s in dispatcher.h.