[C++] format
Updated:
개요
- sprintf와 유사하나 문자열을 반환
- GCC 13.1부터 지원
예제
- 코드
-
#include <format> #include <iostream> #include <string> using namespace std; int main() { cout << format("Hello {}!\n", "world"); cout << format("{}, {}, {}, {}, {}\n", 1, 1.1, true, false, "string"); }
-
- 실행 결과
-
Hello world! 1, 1.1, true, false, string
-