consider:
Code:
//---------------------------------------------------------------------------
#include <map>
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma argsused
class foo
{
std::map<int,int*>m;
public:
foo()
{
int i=1;
m[0]=&i;
}
int func(int key)
{
return *m[key];
}
};
int main(int argc, char* argv[])
{
foo f;
int i = f.func(0);
}
this "seems to work"; but i'm afraid this is just because that temporary's location just still happens to be valid because it hasn't been overwritten or some such.
the documentation for map doesn't appear to specify this aspect of its behavior.
anyone happen to know if it makes an internal permanent copy?