2

What is the meaning of ? operators in the code below? where it is used?

adj[i][j] <?= adj[i][k] >? adj[k][j]

I coulidn't find this operator anywhere else

1 Answers1

8

They're old, non-standard compiler extensions provided by G++ for computing the minimum or maximum of their operands. a <? b is equivalent to min(a, b) (where each operator is computed only once, as in a call to an inline function), while a >? b is equivalent to max(a, b).

The <?= and >?= forms are assignment forms of the operators—a <?=b is equivalent to a = a <? b etc.

In addition to being non-standard, these operators have been deprecated and removed from modern versions of G++. From the deprecated features page:

The G++ minimum and maximum operators (‘<?’ and ‘>?’) and their compound forms (‘<?=’) and ‘>?=’) have been deprecated and are now removed from G++. Code using these operators should be modified to use std::min and std::max instead.

Adam Rosenfield
  • 390,455
  • 97
  • 512
  • 589