18 template<
typename InputIterator,
typename OutputIterator>
19 void convert(InputIterator first_in, InputIterator last_in, OutputIterator first_out)
21 auto f = [](value_type_i<InputIterator> x)
23 return value_type_i<OutputIterator>(x);
25 std::transform(first_in, last_in, first_out, f);
31 template<
typename Container1,
typename Container2>
32 void convert(
const Container1& in, Container2& out)
34 assert(in.size() == out.size());
37 return convert(begin(in), end(in), begin(out));
43 template<
typename InputIterator,
typename T = value_type_i<InputIterator>>
44 T
sum(InputIterator first, InputIterator last, T init = T{})
46 return std::accumulate(first, last, init);
52 template<
typename Container,
typename T = value_type<Container>>
53 T
sum(
const Container& container, T init = T{})
57 return sum(begin(container), end(container), init);
void convert(const Container1 &in, Container2 &out)
Definition: misc_algorithms.hpp:32
T sum(const Container &container, T init=T{})
Definition: misc_algorithms.hpp:53