https://github.com/miroox/type-safe-printf
a type safe printf in c++14
https://github.com/miroox/type-safe-printf
cpp14 printf type-safe
Last synced: about 1 year ago
JSON representation
a type safe printf in c++14
- Host: GitHub
- URL: https://github.com/miroox/type-safe-printf
- Owner: miRoox
- License: mit
- Created: 2017-03-03T05:23:42.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-02-06T04:16:44.000Z (about 4 years ago)
- Last Synced: 2025-02-08T20:26:09.196Z (about 1 year ago)
- Topics: cpp14, printf, type-safe
- Language: C++
- Homepage:
- Size: 20.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 一个类型安全的printf
目前只支持诸如`"%d"`,`"%s"`这样的基本格式
```cpp
int a = 4;
tsprintf("a=%d in %s\n",a); //build failed, missing argument
tsprintf("a=%d in %s\n",__FILE__,a); //build failed, mismatch type
tsprintf("a=%d in %s\n",a++,__FILE__); //ok, and 'a' will be 5
tsprintf("abc%%\n"); //ok
```