Avoid newif you really don't need it, i.e. the variable / structure has a lifetime unrelated to any call area. (If it "belongs" to the calling function, return its value.)
This is clearly not the case. The second preferred example is called a local variable.
I would choose between
for(int i=0;i<3;i++)
{
std::map<int,int> m;
…
}
and
std::map<int,int> m;
for(int i=0;i<3;i++)
{
…
m.clear();
}
, std::vector . map - .