47 template<
typename InputIterator1,
typename InputIterator2,
typename OutputIterator,
48 check_difference<value_type_i<InputIterator1>, value_type_i<InputIterator2>, value_type_i<OutputIterator>> =
nullptr>
49 void subtract(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_difference<Element, value_type_i<InputIterator>, value_type_i<OutputIterator>> =
nullptr>
60 void subtract(
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_difference<value_type_i<InputIterator>, Element, value_type_i<OutputIterator>> =
nullptr>
68 void subtract(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);
77 template<
typename Container1,
typename Container2,
typename Container3,
78 check_difference<value_type<Container1>, value_type<Container2>, value_type<Container3>> =
nullptr>
79 void subtract(
const Container1& left,
const Container2& right, Container3& out)
81 assert(left.size() == out.size());
82 assert(right.size() == out.size());
85 subtract(begin(left), end(left), begin(right), begin(out));
88 template<
typename Element,
typename Container1,
typename Container2,
89 check_difference<Element, value_type<Container1>, value_type<Container2>> =
nullptr>
90 void subtract(
const Element& left,
const Container1& right, Container2& out)
92 assert(right.size() == out.size());
95 subtract(left, begin(right), end(right), begin(out));
98 template<
typename Container1,
typename Element,
typename Container2,
99 check_difference<value_type<Container1>, Element, value_type<Container2>> =
nullptr>
100 void subtract(
const Container1& left,
const Element& right, Container2& out)
102 assert(left.size() == out.size());
105 subtract(begin(left), end(left), right, begin(out));
111 template<
typename Container>
112 Container subtract(
const Container& left,
const Container& right)
115 subtract(left, right, out);
119 template<
typename Container>
120 Container subtract(
const Container& left,
const value_type<Container>& right)
123 subtract(left, right, out);
127 template<
typename Container>
128 Container subtract(
const value_type<Container>& left,
const Container& right)
131 subtract(left, right, out);