Skip to content

Instantly share code, notes, and snippets.

@vlj
Last active January 16, 2017 19:31
Show Gist options
  • Save vlj/f3ad798d7ac2fe3a86208a13759b664e to your computer and use it in GitHub Desktop.
Save vlj/f3ad798d7ac2fe3a86208a13759b664e to your computer and use it in GitHub Desktop.
#include <range/v3/all.hpp>
struct model{
uint16_t indices[3];
};
int main()
{
uint16_t ptr[256];
model models[256 / 3];
const auto& output = ranges::make_range(ptr, ptr + 256) | ranges::view::chunk(3);
const auto& input = ranges::make_range(models, models + 256 / 3) |
ranges::view::transform([](const auto& m) { return ranges::make_range(m.indices, m.indices + 3); }) |
ranges::view::join;
ranges::copy(input, output);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment