This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.

2913. Containers need deduction guides

Section: 24 [containers] Status: Resolved Submitter: United States Opened: 2017-02-03 Last modified: 2017-03-20

Priority: Not Prioritized

View other active issues in [containers].

View all other issues in [containers].

View all issues with Resolved status.

Discussion:

Addresses US 147

One of the motivating features behind deduction guides was constructing containers from a pair of iterators, yet the standard library does not provide any such deduction guides. They should be provided in header synopsis for each container in clause 23. It is expected that the default arguments from the called constructors will provide the context to deduce any remaining class template arguments, such as the Allocator type, and default comparators/hashers for (unordered) associative containers. At this stage, we do not recommend adding additional guides to deduce a (rebound) allocator, comparator etc. due to the likely large number of such guides. It is noted that the requirements on iterator_traits to be an empty type will produce a SFINAE condition to allow correct deduction for vector in the case of the Do-The-Right-Thing clause, resolving ambiguity between two integers, and two iterators.

Proposed change: For each container in clause 23, add to the header synopsis a deduction guide of the form

template <class Iterator>
container(Iterator, Iterator) -> container<typename iterator_traits<Iterator>::value_type>;

[2017-03-12, post-Kona]

Resolved by P0433R2.

Proposed resolution: