Skip to content

<regex>: Should regex_match() use the match_results allocator? #174

@StephanTLavavej

Description

@StephanTLavavej

Reported by https://stackoverflow.com/questions/58399158/use-custom-allocator-for-stdregex-match .

Calling regex_match() or regex_search() with a match_results containing a custom allocator ends up constructing ordinary vector containers in _Matcher, specifically:

STL/stl/inc/regex

Lines 1650 to 1652 in 6aa3b02

_Tgt_state_t<_It> _Tgt_state;
_Tgt_state_t<_It> _Res;
vector<_Loop_vals_t> _Loop_vals;

The Standard is silent on this topic, but libc++ uses the match_results allocator here.

It may be possible to fix this while preserving ABI, by renaming _Matcher (which is a large but internal helper class).

Note: <regex> mostly ignores the existence of allocators; see LWG-1396 "regex should support allocators" and LWG-2216 "regex_replace(basic_string) allocator handling" for examples.

Metadata

Metadata

Assignees

No one assigned

    Labels

    LWG issue neededA wording defect that should be submitted to LWG as a new issueenhancementSomething can be improvedregexmeow is a substring of homeowner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions