Title
No deduction guide for std::match_results
Status
nad
Section
[re.results.general]
Submitter
Jonathan Wakely

Created on 2022-10-25.00:00:00 last changed 17 months ago

Messages

Date: 2022-11-30.17:59:24

Proposed resolution:

This wording is relative to N4917.

  1. Modify [re.results.general], class template match_results synopsis, as indicated:

    namespace std {
      template<class BidirectionalIterator,
               class Allocator = allocator<sub_match<BidirectionalIterator>>>
        class match_results {
          […]
          void swap(match_results& that);
        };
        
      template<class Allocator>
        match_results(Allocator) -> match_results<typename Allocator::value_type::iterator, Allocator>;
    }
    
Date: 2022-11-30.00:00:00

[ 2022-11-30 LWG telecon. Status changed: Tentatively NAD → NAD. ]

Date: 2022-11-15.00:00:00

[ 2022-11-01; reflector poll ]

Status changed to Tentatively NAD. The issue is wrong: other containers do not support deduction from an allocator type.

Date: 2022-10-25.00:00:00

std::match_results meets some of the requirements for an allocator-aware container, which means that its allocator_type must have the same value_type as the container. This means that class template argument deduction should work for:

std::match_results mr(alloc);

The allocator's value_type will be the sub_match<Iter> type stored in the match_results object, and so the first template argument for the match_results type will be value_type::iterator.

P0433R2 added a deduction guide for std::basic_regex, but I see no rationale for not adding one for std::match_results. This seems like a defect, because all other allocator-aware containers support deduction from an allocator argument.

History
Date User Action Args
2022-11-30 17:59:24adminsetmessages: + msg13143
2022-11-01 17:38:24adminsetmessages: + msg12910
2022-11-01 17:38:24adminsetstatus: new -> nad
2022-10-28 12:12:57adminsetmessages: + msg12890
2022-10-25 00:00:00admincreate