`basic_regex` is missing move operations
- Dominant language
- C++
- Stars
- 119
- Forks
- 113
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/boostorg/regex/blob/ed6ebbd5a52b566e454e0cc34494dd2912c6c66c/include/boost/regex/v5/basic_regex.hpp#L370-L377
Notice that while there is a copy constructor and copy assignment operator, there are no move operations. This is bad for two reasons:
1. Clangd may give the user a warning when they apply `std::move` to a type, but no move is actually happening. If the user decides not to `std::move`, they forever pessimize and do not opt into a move constructor added by Boost in the future.
2. Internally, `basic_regex` is wrapping a `std::shared_ptr` to some implementation. `std::shared_ptr` significantly benefits from move operations because it allows for stealing the pointer within another smart pointer; the reference counter is never updated. It is somewhat wasteful not to `std::move` a `std::shared_ptr` when it's possible, even if copying remains a shallow copy.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in include/boost/regex/v5/basic_regex.hpp at lines 370-377 and inspect the existing copy constructor and copy assignment operator. Add the corresponding move operations for basic_regex, then run the Boost.Regex test suite to verify existing behavior remains intact and move construction and assignment are supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100