#cpp #cpp26 String interpolation

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3412r0.pdf

tl;dr example
Point getCenter();

std::string a = f"Center is: {getCenter()}"; // No dangling risk.

auto b = f"Center is: {getCenter()}"; // No dangling problem with P3398

size_t len = f"Center is: {getCenter()}".size(); // Works with P3298

std::println(f"Center is: {getCenter()}"); // Uses optimal overload of println

std::cout << f"Center is: {getCenter()}"; // Uses optimal overload of operator<<
 
 
Back to Top