1

Either I misuse the std:: in front of functions, either there is something I do not understand when using the regex_replace function.

For example, in the piece of code below (the latter compiles and runs correctly on my machine), I don't understand why the scope specification std:: before regex_replace is not required by my compiler (g++ -Wall -std=c++11 v. 6.4.0 on cygwin), whereas all other std:: occurences are.

#include <iostream>
#include <string>
#include <regex>
int main()
{
    std::string myString("myRegexReplaceTest");
    std::cout << myString << std::endl;
    std::cout << regex_replace(myString, std::regex("a|e|i|o|u|y"), "[$&]") << std::endl;
    return 0;
}

What did I miss ?

Regards, xflr6.

Edit : As pointed out to me by juanchopanza, the answer is here, although my question is rised in a very different way... And the answer is much more complete than what I first expected. Thanks.

xflr6
  • 11
  • 2

0 Answers0