Movatterモバイル変換


[0]ホーム

URL:



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

723.basic_regex should be moveable

Section: 28.6.7[re.regex]Status:C++11Submitter: Daniel KrüglerOpened: 2007-08-29Last modified: 2016-01-28

Priority:Not Prioritized

View all otherissues in [re.regex].

View all issues withC++11 status.

Discussion:

Addresses UK 316

According to the current state of the standard draft, the classtemplatebasic_regex, as described in 28.6.7[re.regex]/3, isneitherMoveConstructible norMoveAssignable.IMO it should be, because typical regex state machines tendto have a rather large data quantum and I have seen severaluse cases, where a factory function returns regex values,which would take advantage of moveabilities.

[Sophia Antipolis:]

Needs wording for the semantics, the idea is agreed upon.

[Post Summit Daniel updated wording to reflect new "swap rules".]

[2009-07 Frankfurt:]

Move to Ready.

Proposed resolution:

In the class definition ofbasic_regex, just below 28.6.7[re.regex]/3,perform the following changes:

  1. Just afterbasic_regex(const basic_regex&); insert:

    basic_regex(basic_regex&&);
  2. Just afterbasic_regex& operator=(const basic_regex&); insert:

    basic_regex& operator=(basic_regex&&);
  3. Just afterbasic_regex& assign(const basic_regex& that); insert:

    basic_regex& assign(basic_regex&& that);
  4. In 28.6.7.2[re.regex.construct], just after p.11 add the followingnew member definition:

    basic_regex(basic_regex&& e);

    Effects: Move-constructs abasic_regex instance frome.

    Postconditions:flags() andmark_count() returne.flags() ande.mark_count(), respectively,thate had before construction, leavinge in a valid state with an unspecified value.

    Throws: nothing.

  5. Also in 28.6.7.2[re.regex.construct], just after p.18 add thefollowing new member definition:

    basic_regex& operator=(basic_regex&& e);

    Effects: Returns the result ofassign(std::move(e)).

  6. In 28.6.7.3[re.regex.assign], just after p. 2 add the following newmember definition:

    basic_regex& assign(basic_regex&& rhs);

    Effects: Move-assigns abasic_regex instance fromrhs and returns*this.

    Postconditions:flags() andmark_count() returnrhs.flags()andrhs.mark_count(), respectively, thatrhs had before assignment, leavingrhsin a valid state with an unspecified value.

    Throws: nothing.


[8]ページ先頭

©2009-2026 Movatter.jp