ldx's mentioning of pointers gave me an idea. I've never used shared_ptr before, but I thought it might be the solution, so I looked them up, and I came up with this solution:
Edit: changed to auto_ptr
int main()
{
auto_ptr<vector<string> > vsptr;
{
string s[] = {"Ben", "Joe", "Bob", "Matt"};
int cnt = sizeof(s)/sizeof(string);
vsptr = auto_ptr<vector<string> >(new vector<string>(s,s+cnt));
}
vector<string> &names = *vsptr;
}
I tested it with a class that announces it's constructors, assignments and destructors, and there's only one default construction and one destruction. Of course, this requires boost if your compiler doesn't implement tr1 yet, but what compiler worth a damn doesn't?