Modified dispatcher.h to use uncopyable inplace_functions. This required some significant modification to the uncopyable features added to inplace_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 uncopyable inplace_functions had a copy constructor -- notably std::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 two inplace_function specializations, one copyable and one not, with the shared behavior factored out as much as possible into a separate impl. With this change, std::is_copy_constructible is able to correctly determine the copyability of inplace_functions, leading MSVC's STL to make the right decisions and allowing us to use uncopyable inplace_functions in dispatcher.h.
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.