forked from simongog/sdsl-lite
-
Notifications
You must be signed in to change notification settings - Fork 1
/
store_to_file.cpp
44 lines (41 loc) · 935 Bytes
/
store_to_file.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <sdsl/vectors.hpp>
#include <fstream>
#include <iostream>
using namespace sdsl;
using namespace std;
int main()
{
cout << (has_serialize<bit_vector>::value) << endl;
cout << (has_serialize<uint64_t>::value) << endl;
{
ofstream out("data.sdsl");
bit_vector b = {1,0,0,0,1,1,0};
serialize(b, out);
}
{
ifstream in("data.sdsl");
bit_vector b;
load(b, in);
cout << b << endl;
}
{
uint64_t x = 42;
store_to_file(x, "data.sdsl");
}
{
uint64_t x = 0;
load_from_file(x, "data.sdsl");
cout << x << endl;
}
{
std::vector<uint32_t> x(10, 5);
store_to_file(x, "data.sdsl");
}
{
std::vector<uint32_t> x;
load_from_file(x, "data.sdsl");
cout << x.size() << endl;
for (size_t i=0; i<x.size(); ++i)
cout << x[i] << endl;
}
}