c++ STL函数

来源:互联网 发布:手机淘宝人工客服 编辑:程序博客网 时间:2024/06/11 15:44
  • c++ 无法通过 auto编译

    g++ -std=c++11 test.cpp

  • find

    template <class InputIterator, class T>InputIterator find (InputIterator first, InputIterator last, const T& val);

    Returns an iterator to the first element in the range [first,last) that compares equal to val. If no such element is found, the function returns last.
    http://www.cplusplus.com/reference/algorithm/find/

  • copy

    template <class InputIterator, class OutputIterator>OutputIterator copy (InputIterator first, InputIterator last, OutputIterator result);

    Copies the elements in the range [first,last) into the range beginning at result.
    http://www.cplusplus.com/reference/algorithm/copy/

  • copy_backward

    template <class BidirectionalIterator1, class BidirectionalIterator2>BidirectionalIterator2 copy_backward (BidirectionalIterator1 first,                                    BidirectionalIterator1 last,                                    BidirectionalIterator2 result);

    Bidirectional iterators to the initial and final positions in a sequence to be copied. The range used is [first,last), which contains all the elements between first and last, including the element pointed by first but not the element pointed by last.
    从result指针的前一位开始,result指针前一位用last指针的前一位代替,result指针前2位用last指针的前2位代替.
    http://www.cplusplus.com/reference/algorithm/copy_backward/

0 0
原创粉丝点击