match_results operator[] no longer accepts enums
- Dominant language
- C++
- Stars
- 119
- Forks
- 113
- PR merge metrics
- No merged PRs in 30d
Description
Pull request [208 Suppress conversion warnings in match_results](https://github.com/boostorg/regex/pull/208) broke the ability to pass an unscoped enum to match_results operator[] (and related functions).
This ability was particularly useful because it allowed giving expressive names to matches without having to number them individually (which is error prone).
E.g.:
enum { banana = 1, apple, orange };
boost::regex r("(banana)|(apple)|(orange)");
allowing
match[apple]
with the index value updating automatically when changing the regex (so long as the enum is updated to match).
Two possible fixes:
1. Quick: Add an explicit test for enums
2. Correct: Allow anything which converts implicitly to int, restoring earlier behaviour
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing pull request 208 and the current match_results operator[] and related functions. Use the unscoped-enum example from the issue to determine the intended compatibility behavior, then add or update coverage so the enum lookup works and the relevant regex tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100