📜  make_move_iterator - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:36.408000             🧑  作者: Mango

代码示例1
#include 
#include 
#include 
#include 

int main() 
{
    std::vector v1{"a", "b", "c", "d", "e"};
    std::vector v2(std::make_move_iterator(v1.begin()),
                                std::make_move_iterator(v1.end()));

    std::cout << "v1 size " << v1.size() << '\n';
    std::cout << "v1: ";
    for (const auto& s : v1) std::cout << s << " - ";
    std::cout << '\n';

    std::cout << "v2 size " << v2.size() << '\n';
    std::cout << "v2: ";
    for (const auto& s : v2) std::cout << s << " - ";
    std::cout << '\n';
}