pector icon indicating copy to clipboard operation
pector copied to clipboard

Visual Studio and EBCO [SOLVED, somewhat]

Open degski opened this issue 8 years ago • 0 comments

In pt::malloc_allocator<T, true, true> VS does not (fully) apply empty base class optimization. This reddit post gives a solution for VS2015/U2+ https://www.reddit.com/r/cpp/comments/45bvku/msvc_finally_gets_variable_templates_and_optin/ (please note that __declspec(emptyBases) should be __declspec(empty_bases))

The signature:

template <class T, bool make_reallocable = true, bool make_size_aware = false> struct malloc_allocator: public std::conditional<make_reallocable, reallocable_allocator, internals::dummy1>::type #ifdef PT_SIZE_AWARE_COMPAT , public std::conditional<make_size_aware, size_aware_allocator, internals::dummy2>::type #endif

should be changed to:

template <class T, bool make_reallocable = true, bool make_size_aware = false> struct __declspec( empty_bases ) malloc_allocator: public std::conditional<make_reallocable, reallocable_allocator, internals::dummy1>::type #ifdef PT_SIZE_AWARE_COMPAT , public std::conditional<make_size_aware, size_aware_allocator, internals::dummy2>::type #endif

degski avatar Dec 15 '16 09:12 degski