- 新增现代 C++ 教程的 Preface 章节,包括英文和中文版本 - 添加 C++ Primer 练习代码 - 新增 Learn C++ 教程的 C++ 开发简介章节 - 添加头文件解析文档 - 更新 mkdocs.yml,包含新教程的目录结构 - 修改项目设置,使用 Python 3.10环境
35 lines
748 B
C++
35 lines
748 B
C++
//
|
|
// 9.2.literals.cpp
|
|
// chapter 09 others
|
|
// modern c++ tutorial
|
|
//
|
|
// created by changkun at changkun.de
|
|
// https://github.com/changkun/modern-cpp-tutorial
|
|
//
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
std::string operator"" _wow1(const char *wow1, size_t len) {
|
|
return std::string(wow1)+"woooooooooow, amazing";
|
|
}
|
|
|
|
std::string operator""_wow2 (unsigned long long i) {
|
|
return std::to_string(i)+"woooooooooow, amazing";
|
|
}
|
|
|
|
int main() {
|
|
std::string str = R"(C:\\File\\To\\Path)";
|
|
std::cout << str << std::endl;
|
|
|
|
int value = 0b1001010101010;
|
|
std::cout << value << std::endl;
|
|
|
|
|
|
auto str2 = "abc"_wow1;
|
|
auto num = 1_wow2;
|
|
std::cout << str2 << std::endl;
|
|
std::cout << num << std::endl;
|
|
return 0;
|
|
}
|