C++ 벡터 rotate()

Jmnote (토론 | 기여)님의 2023년 9월 17일 (일) 20:46 판 (→‎참고)

1 개요

C++ 벡터 rotate()
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main () {
  vector<int> v = {1, 2, 3, 4, 5};
  rotate(v.begin(), v.begin()+2, v.end());
  for(int x: v) cout << x << ' '; // 3 4 5 1 2
}

2 같이 보기

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}