Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Replace substring poor
#include <string> #include <cstdio> #include <ctime> #include <regex> void foo(std::string& source, std::string from, std::string to){ source = std::regex_replace(source, std::regex(from), to); } int main(void) { std::string source = ""; for (int i = 0; i < 100500; i++){ source += "five six "; } clock_t t = clock(); foo(source, "six", "super_six"); foo(source, "six", "super_six"); t = clock() - t; printf("%zu '%s' %f sec\n", source.length(), source.substr(100500, 20).c_str(), (double)t/CLOCKS_PER_SEC); }
run
|
edit
|
history
|
help
0
xyp
MINVEST
Conjuntos - Comparar cantidad de elementos únicos en 2 vectores
typedef char*
Dar
Nadpisanie metod
extern
template example
remove_if_30-Seconds-of-C++
CIDP2k19