I think this would be much more reasonable as this:
struct HelloWorld { void operator()() {std::cout<<"Hello world!"<<std::endl;}};
object myobject(HelloWorld());
I generally consider globally-scoped lambdas like these to be dubious constructs. There's nothing to capture, so the only thing you're doing is making it
slightly more convenient to define a struct with an operator() overload.
That being said, I'm not against the feature, so long as it
only applies to lambdas that have no captures. There was a long thread on this forum about applying default constructors to capturing lambdas, and it was generally agreed on that it broke the meaning of the lambda.