C++ Logo


Advanced search

Subject: [std-proposals] [RFC] String_view support for regex
From: Mark de Wever (koraq_at_[hidden])
Date: 2019-09-17 12:44:25


I've posted before about this proposal and based on the feedback here
and on Reddit I've improved my proposal. I've also updated the wording
to the latest draft N4830.

The proposal adds string_view support to various parts of regex. Its
main goal was to make the following code valid:

void foo(std::string_view input) {
    std::regex re{"foo.*bar"};
    std::svmatch match;
    if (regex_match(input, match, re)) {
        std::cout << "Found " << match[0] << "\n";
        std::string_view sv = match[0].view();
        // Do stuff with sv

Attached the latest draft. Any more suggestions how to improve this

(Note haven't asked Arthur to update the Compiler Explorer branch to the
lastest version yet.)

Kind regards,
Mark de Wever

STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups