Algorithm solution:
std::generate(numbers.begin(), numbers.end(), rand);
Range-based for-loop solution:
for (int& x : numbers) x = rand();
Why would I want to use the more verbose
std::generate
over range-based for-loops in C++11?
Quick Q: Does constexpr imply inline? -- StackOverflow
Does constexpr imply inline?
My question is: does the
constexpr
specifier imply theinline
specifier in the sense that if a non-constant argument is passed to aconstexpr
function, the compiler will try to inline the function as if theinline
specifier was put in its declaration ?Does the C++11 standard guarantee that ?