Is there a gcc extension for c++ short-circuiting? -


i'd overload operator&& , operator|| on custom class, , i'd overloaded operators obey short-circuiting behavior of native counterparts.

i know there no mechanism in c++ language, i'm wondering if perhaps gcc might have sort of extension make possible. know such extension cause gcc violate official c++ standard, see disclaimer on gcc documentation reads, "by default, gcc provides additional extensions c++ language on rare occasions conflict c++ standard", doesn't seem outlandish ask.

if there fundamental reason why such extension not work, in theory, know educational purposes. feels me short_circuit_inline keyword can used drop-in replacement inline have well-defined meaning , straightforward implementation, maybe wrong.

for it's worth, have macro workaround, and(x,y,...,z) short-circuited x && y && ... && z instances of custom class. desire operators cosmetic purposes.

the answer "no". gcc c++ extensions documented here: https://gcc.gnu.org/onlinedocs/gcc/c_002b_002b-extensions.html. there no extensions listed there work in manner you've described.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -