Skip to content
This repository was archived by the owner on Apr 20, 2024. It is now read-only.

Visual Studio and EBCO [SOLVED, somewhat] #7

Open
degski opened this issue Dec 15, 2016 · 0 comments
Open

Visual Studio and EBCO [SOLVED, somewhat] #7

degski opened this issue Dec 15, 2016 · 0 comments

Comments

@degski
Copy link

degski commented Dec 15, 2016

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant