Skip to content

allocator_arg and piecewise_construct should use {} #250

@StephanTLavavej

Description

@StephanTLavavej

N3797 20.7.2 [memory.syn] and 20.7.6 [allocator.tag] say:

constexpr allocator_arg_t allocator_arg = allocator_arg_t();

20.2 [utility] and 20.3.5 [pair.piecewise] say:

constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();

This obeys 8.5 [dcl.init]/7 "If a program calls for the default initialization of an object of a const-qualified type T, T shall be a class type with a user-provided default constructor.", but it's verbose. With C++11 tech, we can do better:

constexpr allocator_arg_t allocator_arg{};

constexpr piecewise_construct_t piecewise_construct{};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions