Created
September 4, 2015 07:02
-
-
Save AntonBikineev/3e4bd54936286e0a329a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <numeric> | |
#include <algorithm> | |
#include <hpx/include/serialization.hpp> | |
#include <hpx/util/lightweight_test.hpp> | |
int main() | |
{ | |
static constexpr auto vector_size = HPX_ZERO_COPY_SERIALIZATION_THRESHOLD + 1u; | |
std::vector<char> buffer; | |
std::vector<hpx::serialization::serialization_chunk> chunks; | |
hpx::serialization::output_archive oar{buffer, 0u, ~0u, &chunks}; | |
size_t size = 0u; | |
{ | |
std::vector<unsigned char> array(vector_size); | |
std::iota(std::begin(array), std::end(array), '\0'); | |
oar << hpx::serialization::make_array(array.data(), array.size()); | |
size = oar.bytes_written(); | |
} | |
{ | |
hpx::serialization::input_archive iar{buffer, size, &chunks}; | |
std::vector<unsigned char> array(vector_size); | |
iar >> hpx::serialization::make_array(array.data(), array.size()); | |
unsigned char k = '\0'; | |
for (const auto& i: array) HPX_TEST_EQ(i, k++); | |
} | |
return hpx::util::report_errors(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment