Why is <algorithm> not needed for std::copy or std::swap?
问题 According to this cplusplus.com page, std::copy is in the <algorithm> header, as is std::swap and yet this works: #include <iostream> // std::cout #include <vector> // std::vector #include <iterator> // std::ostream_iterator() #include <cstdlib> // rand(), srand() // NOT including <algorithm> int main() { srand(time(NULL)); const int SIZE = 10; std::vector<int> vec; for(int i = 0; i < SIZE; ++i) { vec.push_back(rand() % 256); } copy(vec.begin(), vec.end(), std::ostream_iterator<int>(std::cout