<s>Human: 请将以下代码转换为C++：
def quick_sort(arr):if len(arr) < 2:return arrelse:pivot = arr[0]less = [i for i in arr[1:] if i <= pivot]greater = [i for i in arr[1:] if i > pivot]return quick_sort(less) + [pivot] + quick_sort(greater)
</s><s>Assistant: #include <iostream>
#include <vector>
using namespace std;

vector<int> quick_sort(vector<int> arr) {
    if (arr.size() < 2) {
        return arr;
    }
    int pivot = arr[0];
    vector<int> less, greater;
    for (int i = 1; i < arr.size(); i++) {
        if (arr[i] <= pivot) {
            less.push_back(arr[i]);
        } else {
            greater.push_back(arr[i]);
        }
    }
    less = quick_sort(less);
    greater = quick_sort(greater);
    vector<int> res;
    for (int i = 0; i < less.size(); i++) {
        res.push_back(less[i]);
    }
    res.push_back(pivot);
    for (int i = 0; i < greater.size(); i++) {
        res.push_back(greater[i]);
    }
    return res;
}

int main() {
    vector<int> arr = {2, 5, 1, 7, 8, 3};
    vector<int> res = quick_sort(arr);
    for (int i = 0; i < res.size(); i++) {
        cout << res[i] << " ";
    }
    cout << endl;
    return 0;
}
</s>