Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Rationale for changes to disambiguation types

13 views
Skip to first unread message

Daniel

unread,
Dec 15, 2019, 9:17:12 AM12/15/19
to
In C++ 2017, the disambiguation tag type allocator_arg_t has been redefined from

struct allocator_arg_t {}; // (*)

to

struct allocator_arg_t { explicit allocator_arg_t() = default; }; // (**)

New disambiguation tag types introduced with 2017, e.g. in_place_t, have the same form as (**). Was there a technical reason for the change that I'm not
seeing?

Thanks,
Daniel







Öö Tiib

unread,
Dec 15, 2019, 9:40:36 AM12/15/19
to
Reason is that letting tag types to be default constructible or
producible from nothing (like from {}) makes no sense and defeats the
purpose of those.

It was defect 2510. "Tag types should not be DefaultConstructible"
<http://cplusplus.github.io/LWG/lwg-defects.html#2510>

Daniel

unread,
Dec 15, 2019, 10:27:32 AM12/15/19
to
On Sunday, December 15, 2019 at 9:40:36 AM UTC-5, Öö Tiib wrote:
> On Sunday, 15 December 2019 16:17:12 UTC+2, Daniel wrote:
> > In C++ 2017, the disambiguation tag type allocator_arg_t has been redefined from
> >
> > struct allocator_arg_t {}; // (*)
> >
> > to
> >
> > struct allocator_arg_t { explicit allocator_arg_t() = default; }; // (**)
> >
>
> It was defect 2510. "Tag types should not be DefaultConstructible"
> <http://cplusplus.github.io/LWG/lwg-defects.html#2510>

Thanks,
Daniel

0 new messages