potswa / cxx_function

Prototype for new std::function features, compatible with C++11.
MIT License
46 stars 7 forks source link

Guarantee static initialization of "vtable" #3

Closed potswa closed 8 years ago

potswa commented 9 years ago

std::tuple does not have constexpr constructors (besides the default one), at least not in C++11 and C++14 which are supported by this library. A custom class would guarantee static initialization and avoid the "static initialization order fiasco" (which, in fact, applies to dynamic initialization of nonlocal variables, but whatever).

Also, it would allow slicing the copy constructor from function "vtables," to produce tables compatible with unique_function even if the latter doesn't have a slot for copy constructors. (Actually, that optimization may be too minor to bother with.)