2 Copyright (c) 2008-2010 Joachim Faulhaber
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt)
10 [/ //= Subtraction ============================================================]
16 [[Subtraction] [__ch_itvs__][__ch_itv_sets__][__ch_itv_maps__][__ch_ele_sets__][__ch_ele_maps__]]
17 [[`T& T::subtract(const P&)`] [ ] [__ei] [__bp] [ ] [__b] ]
18 [[`T& subtract(T&, const P&)`] [ ] [__ei] [__bp] [__e] [__b] ]
20 [[`T& operator -=(T&, const P&)`] [ ] [__eiS][__eiS __bpM][__es] [__bm] ]
21 [[`T operator - (T, const P&)`] [ ] [__eiS][__eiS __bpM][__es] [__bm] ]
23 [[`T left_subtract(T, const T&)`] [1] [ ] [ ] [ ] [ ] ]
24 [[`T right_subtract(T, const T&)`] [1] [ ] [ ] [ ] [ ] ]
27 Functions and operators that implement ['*Subtraction*] on *icl* objects
28 are given in the table above.
31 [[] [Description of Subtraction]]
32 [[`Sets`][Subtraction on Sets implements ['*set difference*]]]
33 [[`Maps`][Subtraction on Maps implements a ['*map difference*] function similar to /set difference/.
34 If, on subtraction of an element value pair `(k,v)` it's key `k` is in the map
35 already, the subtraction function is propagated to the associated value.
36 On the associated value an aggregation is performed, that reverses
37 the effect of the corresponding addition function.
40 [link boost_icl.concepts.aggrovering ['subtractability of maps]]
42 [link boost_icl.semantics.maps ['semantic issues]]
52 [section Functions][/ Subtraction]
54 The admissible combinations of types for subtraction functions
55 can be summarized in the
56 ['*overload table*] below:
59 // overload table for T\P| e i b p
60 T& T::subtract(const P&) ---+--------
61 T& subtract(T&, const P&) s | s
67 The next table contains complexity characteristics for `subtract`.
69 [table Time Complexity for function subtract on icl containers
70 [[`T& T::subtract(const P&)`\n
71 `T& subtract(T&, const P&)`] [__ch_dom_t__][__ch_itv_t__][__ch_dom_mp_t__][__ch_itv_mp_t__]]
72 [[__icl_set__] [__Olgn__] [] [] [] ]
73 [[__icl_map__] [__Olgn__] [] [__Olgn__] [] ]
74 [[__itv_sets__] [__Olgn__] [__a_Olgn__] [] [] ]
75 [[__itv_maps__] [__Olgn__] [__On__] [__Olgn__] [__On__] ]
78 [endsect][/ Member function Subtraction]
81 [section Inplace operators][/ Subtraction]
83 As presented in the overload tables for `operator -=`
84 more type combinations are provided for subtraction than for
88 // overload tables for element containers: interval containers:
89 T& operator -= (T&, const P&) -= | e b s m -= | e i b p S M
90 ---+-------- ---+------------
92 m | m m m m M | M M M M M M
95 Subtraction provides the /reverse/ operation
96 of an addition for these overloads,
99 // Reverse addition -= | e b s m -= | e i b p S M
100 ---+-------- ---+------------
105 [*and] you can erase parts of __icl_maps__ or __itv_maps__
107 /key values/, /intervals/ or /element or interval sets/
108 using these overloads:
111 // Erasure by key objects -= | e b s m -= | e i b p S M
112 ---+-------- ---+------------
117 On Sets both function groups fall together
118 as ['*set difference*].
120 Complexity characteristics for inplace subtraction operations are
121 given by the next tables where
123 n = iterative_size(y);
124 m = iterative_size(x); //if P is a container type
127 [table Time Complexity for inplace Subtraction on element containers
128 [[`T& operator -= (T&, const P&)`][__ch_dom_t__][__ch_dom_mp_t__][__ch_icl_set__][__ch_icl_map__]]
129 [[__icl_set__] [__Olgn__] [] [__Omlgn__] [] ]
130 [[__icl_map__] [__Olgn__] [__Olgn__] [__Omlgn__] [__Omlgn__] ]
134 [table Time Complexity for inplace Subtraction on interval containers
135 [[`T& operator -= (T&, const P&)`][__ch_dom_t__][__ch_itv_t__][__ch_dom_mp_t__][__ch_itv_mp_t__][__ch_itv_sets__][__ch_itv_maps__]]
136 [[interval_sets] [__Olgn__] [__a_Olgn__] [] [] [__Omlgnpm__] [] ]
137 [[interval_maps] [__Olgn__] [__a_Olgn__] [__Olgn__] [__On__] [__Omlgnpm__] [__Omlgnpm__] ]
140 [endsect][/ Inplace operators Subtraction]
143 [section Infix operators][/-Subtraction]
145 The admissible overloads for the infix
146 /subtraction/ `operator -`
147 which is a non commutative
149 is given by the next overload table.
152 // overload tables for - | e b s m - | e i b p S M
153 T operator - (T, const P&) ---+-------- ---+------------
155 m | m m m m M | M M M M M M
157 [endsect][/- Infix operator Subtraction]
160 [section Subtraction on Intervals]
163 [[['*Subtraction*]] [Types] [Description] ]
165 [[`T left_subtract(T right, const T& left_minuend)`] [__i]
166 [subtract `left_minuend` from the interval `right` on it's left side.
168 right_over = left_subtract(right, left_minuend);
170 ... c) : left_minuend
174 [[`T right_subtract(T left, const T& right_minuend)`] [__i]
175 [subtract `right_minuend` from the interval `left` on it's right side.
177 left_over = right_subtract(left, right_minuend);
179 [b ... : right_minuend
185 [endsect][/ Subtraction on Intervals]
191 [[[link boost_icl.function_reference.addition ['*Addition*]] ]]
192 [[[link boost_icl.function_reference.erasure ['*Erasure*]] ]]
194 ['*Back to section . . .*]
197 [[[link function_synopsis_table ['*Function Synopsis*]] ]]
198 [[[link boost_icl.interface ['*Interface*]] ]]
201 [endsect][/ Subtraction]