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

Revert "Make sure the function vtables are initialized before use" #2951

Merged
merged 1 commit into from Oct 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion hpx/util/detail/basic_function.hpp
Expand Up @@ -60,7 +60,7 @@ namespace hpx { namespace util { namespace detail
{
// make sure the empty table instance is initialized in time, even
// during early startup
static VTable const* get_empty_table() noexcept
static VTable const* get_empty_table()
{
static VTable const empty_table =
detail::construct_vtable<detail::empty_function<R(Ts...)> >();
Expand Down
11 changes: 5 additions & 6 deletions hpx/util/detail/vtable/vtable.hpp
Expand Up @@ -25,21 +25,20 @@ namespace hpx { namespace util { namespace detail
template <typename VTable, typename T>
struct vtables
{
static VTable const* get_vtable_instance() noexcept
{
static VTable const instance = construct_vtable<T>();
return &instance;
}
static VTable const instance;
};

template <typename VTable, typename T>
VTable const vtables<VTable, T>::instance = construct_vtable<T>();

template <typename VTable, typename T>
HPX_CONSTEXPR inline VTable const* get_vtable() noexcept
{
static_assert(
std::is_same<T, typename std::decay<T>::type>::value,
"T shall have no cv-ref-qualifiers");

return vtables<VTable, T>::get_vtable_instance();
return &vtables<VTable, T>::instance;
}

///////////////////////////////////////////////////////////////////////////
Expand Down