47 template<
typename InputIterator1,
typename InputIterator2,
typename OutputIterator,
48 check_sum<value_type_i<InputIterator1>, value_type_i<InputIterator2>, value_type_i<OutputIterator>> =
nullptr>
49 void add(InputIterator1 first_left, InputIterator1 last_left, InputIterator2 first_right, OutputIterator first_out)
51 auto f = [](
const value_type_i<InputIterator1>& left,
const value_type_i<InputIterator2>& right)
55 std::transform(first_left, last_left, first_right, first_out, f);
58 template<
typename Element,
typename InputIterator,
typename OutputIterator,
59 check_sum<Element, value_type_i<InputIterator>, value_type_i<OutputIterator>> =
nullptr>
60 void add(
const Element& left, InputIterator first_right, InputIterator last_right, OutputIterator first_out)
62 auto f = [&](
const value_type_i<InputIterator>& right) {
return left + right; };
63 std::transform(first_right, last_right, first_out, f);
66 template<
typename InputIterator,
typename Element,
typename OutputIterator,
67 check_sum<value_type_i<InputIterator>, Element, value_type_i<OutputIterator>> =
nullptr>
68 void add(InputIterator first_left, InputIterator last_left,
const Element& right, OutputIterator first_out)
70 auto f = [&](
const value_type_i<InputIterator>& left) {
return left + right; };
71 std::transform(first_left, last_left, first_out, f);
78 template<
typename Container1,
typename Container2,
typename Container3,
79 check_sum<value_type<Container1>, value_type<Container2>, value_type<Container3>> =
nullptr>
80 void add(
const Container1& left,
const Container2& right, Container3& out)
82 assert(left.size() == out.size());
83 assert(right.size() == out.size());
86 add(begin(left), end(left), begin(right), begin(out));
89 template<
typename Element,
typename Container1,
typename Container2,
90 check_sum<Element, value_type<Container1>, value_type<Container2>> =
nullptr>
91 void add(
const Element& left,
const Container1& right, Container2& out)
93 assert(right.size() == out.size());
96 add(left, begin(right), end(right), begin(out));
99 template<
typename Container1,
typename Element,
typename Container2,
100 check_sum<value_type<Container1>, Element, value_type<Container2>> =
nullptr>
101 void add(
const Container1& left,
const Element& right, Container2& out)
103 assert(left.size() == out.size());
106 add(begin(left), end(left), right, begin(out));
112 template<
typename Container>
113 Container add(
const Container& left,
const Container& right)
116 add(left, right, out);
120 template<
typename Container>
121 Container add(
const Container& left,
const value_type<Container>& right)
124 add(left, right, out);
128 template<
typename Container>
129 Container add(
const value_type<Container>& left,
const Container& right)
132 add(left, right, out);