Jak stworzyć iterator taki, aby sort sortował od początku tablicy do wskazanego elementu? Mam taki kod:
#include <stdio.h>
#include <algorithm>
#include <vector>
#define ui unsigned int
std::vector<std::pair <ui, ui> >W(10000);
int main() {
ui n;
scanf("%u", &n);
for(ui i=0; i<n; i++)
scanf("%u", &W[i].first);
for(ui i=0; i<n; i++)
scanf("%u", &W[i].second);
std::sort(W.rbegin(), W.rend());
}
Chodzi o to, żeby nie sortował 10000 elementów, tylko te pierwsze n. Dziękuję za wszelką pomoc.