Par exemple:Est-il possible d'initialiser un objet à partir d'une étendue externe dans une étendue interne?
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);
}
}
Est-il possible de le faire?
Votre utilisation de pointeurs m'a donné une bonne idée. –