Argument evaluation order is up to the compiler.
Thus, in the line
std::cout << "Next prime number " << " is " << prime.next() << "..." << prime.next() << "..." << prime.next() << std::endl;
the prime.next()
calls can be evaluated in any order that suits the compiler.
In passing, don't #include
implementation files unless you really know what you're doing.
You risk getting e.g. multiple definition errors from the linker.
Also, in C++ there is no need to define a constant as a macro, using #define
. Instead just define the constant, and avoid e.g. unintended text substitutions and eyesores from reading all uppercase. Defining constants is, in large part, what const
is for.