败犬日报 2026-03-07
败犬日报 2026-03-07
1. 模板参数里的右移符号
cpp
std::array<int, 10 >> 2> a; // error
std::array<int, (10 >> 2)> a; // ok不加括号就会被识别为模板的尖括号。
If the next two characters are
>>and one of the>character can complete a template identifier, the character is treated as a preprocessing token alone instead of being part of the preprocessing token>>.
如果第一个 > 可以匹配尖括号 <...>,那整个 >> 就视为一个 token(表示两个尖括号)。这样 vector<vector<int>> 就不用写成 vector<vector<int> >。
2. c语言怎么“简单”表示9个变量互不相等?(文章)
https://www.zhihu.com/question/597274781/answer/3042727874
双调排序。