Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
iod::array_view
#include <iostream>
#include <iod/array_view.hh>
#include "symbols.hh"
#include <cassert>
int main()
{
using namespace iod;
using namespace s;
{
std::vector<int> A = {1,2,3,4};
auto v = array_view(A.size(), [&] (int i) {
return A[i] * 2; });
for (int i = 0; i < int(v.size()); i++)
assert(v[i] == (i+1) * 2);
for (auto x : v) std::cout << x << std::endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.