【发布时间】:2011-04-25 20:19:23
【问题描述】:
例如:
int main()
{
{
// I want this array to be part of the inner scope
string s[] = {"Ben","Joe","Bob","Matt"};
// And I want to use it to initialize this vector, but I want this
// vector to be visible in the outer scope
vector<string> names(s,s+4);
}
}
有什么办法吗?
【问题讨论】:
标签: c++ scope initialization