This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

### 1209. `match_results` should be moveable

Section: 30.9.2 [re.results.const] Status: C++11 Submitter: Stephan T. Lavavej Opened: 2009-09-15 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [re.results.const].

View all issues with C++11 status.

Discussion:

In Working Draft N2914, `match_results` lacks a move constructor and move assignment operator. Because it owns dynamically allocated memory, it should be moveable.

As far as I can tell, this isn't tracked by an active issue yet; Library Issue 723 doesn't talk about `match_results`.

[ 2009-09-21 Daniel provided wording. ]

[ 2009-11-18: Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]

Proposed resolution:

1. Add the following member declarations to 30.9 [re.results]/3:

   >     // 28.10.1, construct/copy/destroy:
   >     explicit match_results(const Allocator& a = Allocator());
   >     match_results(const match_results& m);
   >     match_results(match_results&& m);
   >     match_results& operator=(const match_results& m);
   >     match_results& operator=(match_results&& m);
   >     ~match_results();

2. Add the following new prototype descriptions to 30.9.2 [re.results.const] using the table numbering of N3000 (referring to the table titled "`match_results` assignment operator effects"):

   >     match_results(const match_results& m);

   > > 4 Effects: Constructs an object of class `match_results`, as a copy of `m`.

   >     match_results(match_results&& m);

   > > 5 Effects: Move-constructs an object of class `match_results` from `m` satisfying the same postconditions as Table 131. Additionally the stored `Allocator` value is move constructed from `m.get_allocator()`. After the initialization of `*this` sets `m` to an unspecified but valid state.

   > > 6 Throws: Nothing if the allocator's move constructor throws nothing.

   >     match_results& operator=(const match_results& m);

   > > 7 Effects: Assigns `m` to `*this`. The postconditions of this function are indicated in Table 131.

   >     match_results& operator=(match_results&& m);

   > > 8 Effects: Move-assigns `m` to `*this`. The postconditions of this function are indicated in Table 131. After the assignment, `m` is in a valid but unspecified state.

   > > 9 Throws: Nothing.