Initialize std::array with a range (pair of iterators)
问题 How can I initialize an std::array from a range (as defined by a pair of iterators)? Something like this: vector<T> v; ... // I know v has exactly N elements (e.g. I just called v.resize(N)) // Now I want a initialized with those elements array<T, N> a(???); // what to put here? I thought array would have a constructor taking a pair of iterators, so that I could do array<T, N> a(v.begin(), v.end()) , but it appears to have no constructors at all! I know I can copy the vector into the array,