Verify a certain number of command line arguments without using if statement

closed account (L1bXjE8b)
I would like to verify a certain number of command line arguments are given, but without using an if statement or similar. I want to change something like this:
1
2
3
if ( argv < 2 ) {
    cerr << "Enter more command line arguments.";
}


Is there any way to achieve this without using an if statement?
You could use the ?: operator but why would you want to? An if statement is the correct way to do this and using anything else would decrease the readability of your program.
closed account (L1bXjE8b)
It does decrease the readability, but it takes a segment of code from O(n) down to O(1). Are there any standard functions built into C++ that could solve this?
You are wasting time.

First, go and profile your program and show that the if statement causes a significant performance hit when initializing your program.

(You will never be able to do that.)

Use the if statement.
Topic archived. No new replies allowed.