Created
July 30, 2017 07:53
-
-
Save odeblic/36124fff851474f6e48cdb9967b09e09 to your computer and use it in GitHub Desktop.
To be tested...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <sstream> | |
int main(int argc, char ** argv) | |
{ | |
std::string content; | |
std::stringstream buffer; | |
if (argc > 1) | |
{ | |
//buffer.reserve(100000000); | |
content.reserve(100000000); | |
buffer.str(content); | |
buffer.seekg(0); | |
std::cout << "reserve memory" << std::endl; | |
} | |
std::cout << "size: " << buffer.str().size() << std::endl; | |
for(int i=1; i<=1000000; ++i) | |
{ | |
buffer << "blabla" << i; | |
buffer << "zoozoo" << i + 2; | |
} | |
std::cout << "size: " << buffer.str().size() << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment