Title
An is_aggregate type trait is needed
Status
c++17
Section
[meta.unary.prop]
Submitter
United States

Created on 2017-02-03.00:00:00 last changed 38 months ago

Messages

Date: 2017-03-03.22:19:58

Proposed resolution:

This wording is relative to N4640.

  1. Modify [meta.type.synop], <type_traits> header synopsis, as indicated:

    // 20.15.4.3, type properties
    […]
    template <class T> struct is_final;
    template <class T> struct is_aggregate;
    
    […]
    // 20.15.4.3, type properties
    […]
    template <class T> constexpr bool is_final_v
      = is_final<T>::value;
    template <class T> inline constexpr bool is_aggregate_v
      = is_aggregate<T>::value;
    […]
    
  2. Add a new row to Table 42 — "Type property predicates":

    template <class T> struct is_aggregate;
    

    T is an aggregate type ([dcl.init.aggr])

    remove_all_extents_t<T> shall be a complete type or cv void.

Date: 2017-03-03.22:19:58

[ Kona 2017-03-02 ]

Accepted as Immediate to resolve NB comment.

This will require a new complier intrinsic; Alisdair checked with Core and they're OK with that

Date: 2017-03-15.00:00:00

[ 2017-03-03, Daniel updates wording ]

In sync with existing writing, this was changed to "remove_all_extents_t<T> shall be a complete type or cv void"

Date: 2017-03-15.00:00:00

[ 2017-03-03, Kona, LEWG ]

No interest in doing the is-list-initializable instead. No objection to getting that proposal also.

Want this for C++17?

SF | F | N | A | SA

2 | 8 | 1 | 3 | 0

Want this for C++20?

SF | F | N | A | SA

6 | 5 | 2 | 0 | 0

Remember to correct the wording to: "remove_all_extents_t<T> shall be a complete type or cv-void."

Date: 2017-03-15.00:00:00

[ 2017-03-01, Daniel comments and adjusts wording ]

There is only one minor change performed, namely to mark the constant in the is_aggregate_v variable template as inline following the LWG preferences for "full inline" bullet list (B2) from P0607R0.

Date: 2017-02-15.00:00:00

[ 2017-02-26, Daniel comments and completes wording ]

The proposed wording is incomplete, since it doesn't update the <type_traits> header synopsis, also ensuring that the corresponding is_aggregate_v variable template is defined.

Date: 2017-02-05.14:22:11
Addresses US 143

An is_aggregate type trait is needed. The emplace idiom is now common throughout the library, but typically relies on direct non-list initalization, which does not work for aggregates. With a suitable type trait, we could extend direct non-list-initlaization to perform aggregate-initalization on aggregate types.

Proposed change:

Add a new row to Table 38:

template <class T>
struct is_aggregate;

T is an aggregate type ([dcl.init.aggr])

remove_all_extents_t<T> shall be a complete type, an array type, or (possibly cv-qualified) void.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2017-03-05 23:46:08adminsetstatus: immediate -> wp
2017-03-03 22:19:58adminsetmessages: + msg9074
2017-03-03 22:19:58adminsetstatus: new -> immediate
2017-03-03 20:10:51adminsetmessages: + msg9048
2017-03-03 20:10:51adminsetmessages: + msg9047
2017-03-01 22:12:41adminsetmessages: + msg9032
2017-02-26 18:48:46adminsetmessages: + msg9002
2017-02-04 04:54:35adminsetmessages: + msg8903
2017-02-03 00:00:00admincreate