SyntaxFix
Write A Post
Hire A Developer
Questions
You could use a lambda:
const FooBar fb = [&] { FooBar fb; fb.foo = 12; fb.bar = 3.4; return fb; }();
More information on this idiom can be found on Herb Sutter's blog.