http://stxxl.sourceforge.net
<singler@ira.uka.de>
http://www.boost.org/LICENSE_1_0.txt
#include <iostream>
#include <algorithm>
#include <stxxl/vector>
#include <stxxl/scan>
typedef stxxl::int64 int64;
int main()
{
try
{
typedef stxxl::VECTOR_GENERATOR<int64, 2, 2, (2 * 1024 * 1024), stxxl::striping>::result vector_type;
vector_type v(int64(64 * 1024 * 1024) / sizeof(int64));
stxxl::random_number32 rnd;
int offset = rnd();
STXXL_MSG("write " << v.size() << " elements");
stxxl::ran32State = 0xdeadbeef;
vector_type::size_type i;
for (i = 0; i < v.size(); ++i)
{
v[i] = i + offset;
assert(v[i] == int64(i + offset));
}
v.flush();
STXXL_MSG("export files");
v.export_files("exported_");
}
catch (const std::exception & ex)
{
STXXL_MSG("Caught exception: " << ex.what());
}
catch (...)
{
STXXL_MSG("Caught unknown exception.");
}
return 0;
}