Skip to content

Instantly share code, notes, and snippets.

@brycelelbach
Created February 22, 2017 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brycelelbach/63677e547eb957ccc879e139a0effefd to your computer and use it in GitHub Desktop.
Save brycelelbach/63677e547eb957ccc879e139a0effefd to your computer and use it in GitHub Desktop.
#include <iostream>
#include <vector>
#include <numeric>
#include <iterator>
#include <cstdint>
int main()
{
std::vector<std::uint8_t> u{255, 255};
std::vector<int> i;
std::partial_sum(u.begin(), u.end(), std::back_inserter(i));
std::cout << i.back() << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment