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

Visual Studio and EBCO [SOLVED, somewhat] #7

Description

@degski

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions