Quick Q: How to initialize a const object (say vector) with complex initialization? -- StackOverflow
Quick A: With a lambda function. Try
const mytype myobj{ []{ /* compute value */ return value; } }.
How would you initialize a const vector of function results using C++11?
Is it possible to use something like
generate_nto create aconst vectorof, say, random numbers? I couldn't think of a way to do it without derivingvectorand doing the assignment in the constructor.




