- // Note: We put all vectors and lists on the heap, not the stack
-
- const vector<Row> rows = get_rows();
-
- // Use forward_lists for faster merging
- forward_list<Annotation> *all_ann_list = new forward_list<Annotation>();
-
- for (const Row& row : rows) {
- vector<Annotation> *ann_vector = new vector<Annotation>();
- get_annotation_subset(*ann_vector, row, segment_id, start_sample, end_sample);
-
- forward_list<Annotation> *ann_list =
- new forward_list<Annotation>(ann_vector->begin(), ann_vector->end());
- delete ann_vector;
-
- all_ann_list->merge(*ann_list);
- delete ann_list;
- }
-
- move(all_ann_list->begin(), all_ann_list->end(), back_inserter(dest));
- delete all_ann_list;
+ for (const Row* row : get_rows())
+ get_annotation_subset(dest, row, segment_id, start_sample, end_sample);