Functions
A function using some STL containers and algorithm.
function_w_stl.cpp
#include <c2py/c2py.hpp>
#include <vector>
#include <numeric>
double sum(std::vector<double> const &v) { return std::accumulate(begin(v), end(v), 0.0); }
In Python, we get:
>>> import function_w_stl as M
>>> M.sum([1.2, 2.3, 4.5])
8.0