a>?=b 是什么意思?
What does a>?=b mean?
我发现了下面的代码,不明白它的意思:
res>?=m[2];
这是我找到它的代码和一些上下文
vector<int> m(3);
int s = 0;
... do stuff with m ...
res>?=m[2];
return res;
它是一个旧的GCC扩展。
a >?= b
的等价物是a = max(a,b);
您可以查看C++中的最小和最大运算符
让操作员返回"最小值"或两个参数的"最大值"。在GNU C++中(但不在GNU C中),
a <? b
是最小值,返回数值a和b中较小的一个;
a>?b
是最大值,返回数值a和b中较大的一个。
附带说明:-
这些运算符是非标准的,在GCC中不推荐使用。您应该使用std::min和std::max。
这肯定不是标准的C++。我可以猜测这是赋值+三元运算符的快捷方式,类似于赋值+二元运算符,如operator+=
和其他:
res = (res > m[2]) ? res : m[2];
你可以在这里阅读相关内容:C++语言的扩展:
a <? b
is the minimum, returning the smaller of the numeric values a and b;
a >? b
is the maximum, returning the larger of the numeric values a and b.
相关文章:
- 这个语法std::class<>{}(arg1, arg2) 在C++中是什么意思?
- 标准 N3337 5.2.10 第 7 条中的C++"类型"是什么意思?
- "类模板示例<int>;"语句对 C++11 是什么意思?
- 线应该是什么意思
- "CID"在AT+HTTPPARA= "CID" ,1中是什么意思
- 表达式"b=(b-x)&x"是什么意思?
- 这个表达是什么意思?
- 此代码验证公式是什么意思?
- 跟踪日志中的T.11803()是什么意思?
- 这个额外的关键字在这个 c++ 类声明中是什么意思?
- * 和 ** 在 C++ 函数声明中是什么意思?
- _T("xyz")是什么意思?
- #define Dbg(fmt,..) (0) 是什么意思? 警告:表达式无效
- 这行代码到底是什么意思?
- 在命名空间名称之前加上 :: 是什么意思?
- 从字符数组的元素中减去'a'是什么意思
- "friend"关键字在C++中是什么意思?
- 减法中的"0"是什么意思?
- 字符数组前面的加号是什么意思?
- 这里的字符串函数是什么意思