Title
Requirements on the first template parameter of container adaptors
Status
c++17
Section
[container.adaptors]
Submitter
Tim Song

Created on 2015-12-08.00:00:00 last changed 82 months ago

Messages

Date: 2016-02-07.20:24:45

Proposed resolution:

This wording is relative to N4567.

  1. Edit [container.adaptors.general]/2 as indicated:

    -2- The container adaptors each take a Container template parameter, and each constructor takes a Container reference argument. This container is copied into the Container member of each adaptor. If the container takes an allocator, then a compatible allocator may be passed in to the adaptor's constructor. Otherwise, normal copy or move construction is used for the container argument. The first template parameter T of the container adaptors shall denote the same type as Container::value_type.

Date: 2016-02-07.20:24:45

[ 2016-02, Issues Telecon ]

P0; move to Tentatively Ready.

Date: 2015-12-28.13:15:27

As noted in this StackOverflow question, [container.adaptors] doesn't seem to place any requirement on the first template parameter (T) of stack, queue, and priority_queue: the only use of T is in the default template argument (which need not be used) for the second template parameter (Container), while all of the operations of the adaptors are defined using Container's member typedefs.

This permits confusing and arguably nonsensical types like queue<double, deque<std::string>> or priority_queue<std::nothrow_t, vector<int>>, which presumably wasn't intended.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2016-03-07 04:11:48adminsetstatus: ready -> wp
2016-02-07 20:24:45adminsetmessages: + msg7961
2016-02-07 20:24:45adminsetstatus: new -> ready
2015-12-16 20:34:32adminsetmessages: + msg7654
2015-12-08 00:00:00admincreate