小编Tom*_*one的帖子

Constexpr与宏

我应该在哪里使用宏,哪里更喜欢constexpr?它们基本不一样吗?

#define MAX_HEIGHT 720
Run Code Online (Sandbox Code Playgroud)

VS

constexpr unsigned int max_height = 720;
Run Code Online (Sandbox Code Playgroud)

c++ macros constexpr c++11

54
推荐指数
3
解决办法
2万
查看次数

C++支持的字符

当我用外国人写字时(法语......)似乎有问题

例如,如果我要求输入std :: string或char [],如下所示:

std::string s;
std::cin>>s;  //if we input the string "café"
std::cout<<s<<std::endl;  //outputs "café"
Run Code Online (Sandbox Code Playgroud)

一切都好.

虽然字符串是硬编码的

std::string s="café";
std::cout<<s<<std::endl; //outputs "cafÚ"
Run Code Online (Sandbox Code Playgroud)

到底是怎么回事?C++支持哪些字符,如何使其正常工作?它与我的操作系统(Windows 10)有关吗?我的IDE(VS 15)?还是用C++?

c++ unicode character-encoding c++14

6
推荐指数
1
解决办法
807
查看次数

标签 统计

c++ ×2

c++11 ×1

c++14 ×1

character-encoding ×1

constexpr ×1

macros ×1

unicode ×1