Guest User

Untitled

a guest
Jun 24th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. template<bool writeout> double sumNumbers(const std::vector<double> &numbers, double *out_partialsums) {
  2. double total = 0.0;
  3. for (int i = 0; i < numbers.size(); i++) {
  4. total += numbers[i];
  5.  
  6. /* ... */
  7.  
  8. if (writeout) {
  9. out_partialsums[i] = total;
  10. }
  11. }
  12. return total;
  13. }
  14.  
  15. auto result = sumNumbers<false>(numbers, NULL)
Add Comment
Please, Sign In to add comment