3

Possible Duplicate:
What does the >?= operator mean?

I have encountered this line,

bot <?= fnet[v][u] ? fnet[v][u] : ( cap[u][v] - fnet[u][v] );

what does this <?=sign mean? Visual Studio 2012 says that it doesnt exist, then what is it? Maybe it was in some previous versions?

Thanks

Community
  • 1
  • 1
epsilon
  • 73
  • 8

1 Answers1

5

Visual Studio is right, the operator is no longer valid. I'm not sure if it ever was, or it was a language extension. EDIT: It was a gcc extension that was removed - http://gcc.gnu.org/ml/gcc/2005-09/msg00299.html

It's a conditional assignment - a <?= b means "assign b to a if a < b."

You can use std::min and std::max instead.

bot <?= fnet[v][u] ? fnet[v][u] : ( cap[u][v] - fnet[u][v] );

would translate to

bot = std::min(bot, fnet[v][u] ? fnet[v][u] : (cap[u][v]-fnet[u][v]) );
Luchian Grigore
  • 253,575
  • 64
  • 457
  • 625
  • Thanks, so bot = fnet[v][u] ? fnet[v][u] : ( cap[u][v] - fnet[u][v] ); means that: if ( bot < fnet[v][u]) then fnet[v][u] = bot else bot = cap[u][v] - fnet[u][v] ? – epsilon Nov 25 '12 at 01:39