<?=运算符C++更少的问号等于符号

Lea*_*dro 8 c++ overloading variable-assignment operator-keyword

我在代码中看到<?=和>?=:http://community.topcoder.com/stat?c = proby_solution&rm = 151152&rd = 585&pm = 2923&cr = 310333

我尝试编译没有包括测试它是否是标准,但它不起作用.然后我添加了包含,但它仍然给出了相同的错误:

question-mark.cpp:15:5:错误:在'?'之前预期的primary-expression token question-mark.cpp:15:6:error:在'='之前预期的primary-expression标记question-mark.cpp:15:9:error:expected':'before';' token question-mark.cpp:15:9:error:在';'之前预期的primary-expression 代币

#include <stdio.h>
#include <algorithm> 
#include <iostream> 
#include <sstream> 
#include <string> 
#include <vector> 

using namespace std;

int main()
{

    int x = 3;
    int y = 2;
    x >?= y;
    printf("x = %d\n", x);

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

以下是链接代码中的使用方法:

x <?= h[i][j];  // x = (h[i][j] < x) ? h[i][j] : x;
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

das*_*ght 9

这些是GCC扩展运营商.a <?= ba = min(a, b)(>?=是"max"运算符)具有相同的含义,但它仅评估其左侧表达式一次.当a变量是变量时,这并不重要,但在a表示表达式时可能会有所不同,尤其是当表达式具有副作用时.例如,在

*dest++ <?= *src++;
Run Code Online (Sandbox Code Playgroud)

++dest++会只进行一次评估.

这两个运营商现已被弃用.