Determine the maximal length of the strings falling under the Small String Optimization of your standard library
January 3, 2024 ยท View on GitHub
#include
template
};
template <typename T, typename U>
inline bool operator == (failing_alloc
template <typename T, typename U>
inline bool operator != (failing_alloc
int main() {
std::cout << "sizeof(std::string) = " << sizeof(std::string) << " bytes\n";
using stack_str = std::basic_string<char, std::char_traits<char>, failing_alloc<char>> ;
stack_str str;
for (std::size_t i = 1; i < 100; ++i) {
str.push_back('a');
std::cout << "Appended " << i << " bytes\n";
}
return 0;
}