I've tried this:
#include <map>
int main() {
static std::map<int,int> myMap = [](){
std::map<int,int> myMap;
return myMap;
};
}
error:
<stdin>: In function 'int main()':
<stdin>:8:3: error: conversion from 'main()::<lambda()>' to non-scalar type 'std::map<int, int>' requested
And yes, I know that I can create another 'normal' function for it ant it works but lambdas cannot initialize objects in that way.