Skip to content

Instantly share code, notes, and snippets.

View mrts's full-sized avatar

Mart Sõmermaa mrts

  • Tallinn, Estonia (EET, UTC +2 hours)
View GitHub Profile
@mrts
mrts / test-string-reserve-impact-for-ostringstream.cpp
Created February 20, 2025 17:54
Determine whether manually reserving capacity in a std::string reduces memory usage when that string is later moved into a std::ostringstream.
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <random>
using byte = unsigned char;
using byte_vector = std::vector<byte>;