Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ calling variable constructor

#include <type_traits>

template <class T, typename... Args>
void Reconstruct(T& x, Args&&... args)
{
    static_assert(!std::has_virtual_destructor<T>::value, "Unsafe"); 
    x.~T();
    new (&x) T(std::forward<Args>(args)...);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #calling #variable #constructor
ADD COMMENT
Topic
Name
9+8 =