Is there an equivalent of Python's `pass` in c++ std11?

c++, python

Solution

A null statement (just Semicolon), or empty brackets should work for you

For example Python's

while some_condition():    # presumably one that eventually turns false
    pass

Could translate to the following C++

while (/* some condition */)
    ;

Or

while (/* some condition */) {}

Perhaps for the ternary operator case, you could do:

x > y ? do_something() : true;

Problem

I want a statement that does nothing but can be used in places requiring a statement. Pass: http://docs.python.org/release/2.5.2/ref/pass.html Edit: Just saw: How does one execute a no-op in C/C++? ``` #define pass (void)0 ``` Solved my problem. Thanks!

Original source

Related problems