替換printf的C++庫:tinyformat.h
這是一個最小的類型安全替換printf的C++庫。
設計目標:
- Simplicity and minimalism. A single header file to include and distribute with your own projects.
- Type safety and extensibility for user defined types.
- Support as many commonly used C99 printf() features as practical without compromising on simplicity.
- Use variadic templates with C++0x but provide good C++98 support for backward compatibility </ul>
示例用法:
std::string weekday = "Wednesday"; const char* month = "July"; long day = 27; int hour = 14; int min = 44; tfm::format(std::cout, "%s, %s %d, %.2d:%.2d\n", weekday, month, day, hour, min);
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!