File: int-vector-buffer-iterator.cpp

package info (click to toggle)
libsdsl 2.1.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,992 kB
  • sloc: cpp: 42,286; makefile: 1,171; ansic: 318; sh: 201; python: 27
file content (22 lines) | stat: -rw-r--r-- 483 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <sdsl/vectors.hpp>
#include <iostream>
#include <algorithm>

using namespace sdsl;
using namespace std;

int main()
{
    string file = "int_vector_buffer_iterator.sdsl";
    {
        int_vector<> iv = {1,2,3,4,5,9,8,7,6};
        store_to_file(iv, file);
    }
    int_vector_buffer<> ivb(file);
    cout << std::accumulate(ivb.begin(), ivb.end(), 0) << endl;
    cout << std::count_if(ivb.begin(), ivb.end(), [](uint64_t x) {
        return 0 == x%2;
    }) << endl;
}