<regex>: Should regex_match() use the match_results allocator?
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.2k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
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:
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in stl/inc/regex at the _Matcher construction around lines 1650-1652, then review how regex_match() and regex_search() use match_results with custom allocators. Compare the libc++ behavior and the referenced LWG-1396 and LWG-2216 discussions. Done means the allocator behavior is resolved while preserving ABI, with the affected custom-allocator cases validated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100