File: functions_symmetric_difference.qbk

package info (click to toggle)
boost1.74 1.74.0-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 464,084 kB
  • sloc: cpp: 3,338,324; xml: 131,293; python: 33,088; ansic: 14,336; asm: 4,034; sh: 3,351; makefile: 1,193; perl: 1,036; yacc: 478; php: 212; ruby: 102; lisp: 24; sql: 13; csh: 6
file content (163 lines) | stat: -rw-r--r-- 6,448 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
[/
    Copyright (c) 2008-2010 Joachim Faulhaber

    Distributed under the Boost Software License, Version 1.0.
    (See accompanying file LICENSE_1_0.txt or copy at
    http://www.boost.org/LICENSE_1_0.txt)
]


[/ //= Symmetric Difference ===================================================]
[section Symmetric Difference]

[section Synopsis][/ Symmetric difference]

[table
[[Symmetric difference]         [__ch_itv_sets__][__ch_itv_maps__][__ch_ele_sets__][__ch_ele_maps__] ]

[[`T& T::flip(const P&)`]                      [__ei]     [__bp]   [ ]     [__b]     ]
[[`T& flip(T&, const P&)`]                     [__ei]     [__bp]   [__e]   [__b]     ]
[[`T& operator ^=(T&, const P&)`]              [__eiS]    [__bpM]  [__es]  [__bm]    ]
[[`T  operator ^ (T, const P&)`\n
  `T  operator ^ (const P&, T)`]               [__eiS]    [__bpM]  [__es]  [__bm]    ]

]

Functions and operators that implement ['*symmetric difference*] on *icl* objects
are given in the table above.

[table
[[]      [Description of symmetric difference]]
[[`Sets`][`operator ^` implements ['*set symmetric difference*]]]
[[`Maps`][`operator ^` implements a ['*map symmetric difference*] 
          function similar to /set symmetric difference/.
          All pairs that are common to both arguments are removed. All others unified.
         ]]
]


[endsect][/ Synopsis Symmetric difference]

[section Functions][/ Symmetric difference]

/Symmetric difference/ is implemented on interval containers
by the function `T& flip(T&, const P& operand)`.

``
flip(y,x)
`` 

deletes every element of `y`, 
if it is contained in `x`. Elements of
`x` not contained in `y` are added.
For icl containers flip is also availabel as memeber function
`T& T::flip(const P& operand)`.

[/ paratract, surtract, symetract, topple, symmetric_subtract]

The admissible combinations of types for member function 
`T& T::flip(const P&)` can be summarized in the 
['*overload table*] below:

``
/* overload table for */           T\P| e i b p  
T& T::flip(const P&)               ---+--------
T& flip(T&, const P&)               s | s
                                    m |     m
                                    S | S S     
                                    M |     M M
``

The next table contains complexity characteristics for functions `flip`.

[table Time Complexity for member functions flip on icl containers
[[`T& T::flip(const P&)`\n
  `T& flip(T&, const P&)`]     [__ch_dom_t__][__ch_itv_t__][__ch_dom_mp_t__][__ch_itv_mp_t__]]
[[__icl_set__]                 [__Olgn__] []          []        []          ]
[[__icl_map__]                 []         []          [__Olgn__][]          ]
[[__itv_set__\n__sep_itv_set__][__Olgn__] [__On__]    []        []          ]
[[__spl_itv_set__]             [__Olgn__] [__On__]    []        []          ]
[[__itv_map__\n__spl_itv_map__][]         []          [__Olgn__][__On__]    ]
]

[endsect][/ Member functions Symmetric difference]


[section Inplace operators][/ Symmetric Difference]

The overload tables below are giving admissible
type combinations for `operator ^=`
that implements ['*symmetric difference*].

``
// overload tables for             element containers:     interval containers:
T& operator ^= (T&, const P&)      ^= | e b s m            ^= | e i b p S M    
                                   ---+--------            ---+------------    
                                   s  | s   s              S  | S S     S      
                                   m  |   m   m            M  |     M M   M    
``
Complexity characteristics for inplace operators
that implement ['*symmetric difference*]
are given by the next tables where 
``
n = iterative_size(y);
m = iterative_size(x); //if P is a container
``

[table Time Complexity for inplace symmetric difference on element containers
[[`T& operator &= (T& y, const P& x)`][__ch_dom_t__][__ch_dom_mp_t__][__ch_icl_set__][__ch_icl_map__]]
[[__icl_set__]                    [__Olgn__]    []               [__Omlgn__]     []              ]
[[__icl_map__]                    [__Olgn__]    [__Olgn__]       [__Omlgn__]     [__Omlgn__]     ]
]

[table Time Complexity for inplace symmetric difference on interval containers
[[`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__]]
[[interval_sets]                  [__Olgn__]    [__On__]      []               []               [__Omlgnpm__]    []               ]
[[interval_maps]                  [__Olgn__]    [__On__]      [__Olgn__]       [__On__]         [__Omlgnpm__]    [__Omlgnpm__]    ]
]

[endsect][/ Inplace operators Symmetric Difference]

[section Infix operators][/ Symmetric Difference]

For the infix version of symmetric difference the
following overloads are available:

``
// overload tables for             element containers:     interval containers:
T operator ^ (T, const P&)         ^  | e b s m            ^  | e  i  b  p  S1 S2 S3 M1 M3
T operator ^ (const P&, T)         ---+--------            ---+---------------------------
                                   e  |     s              e  |             S1 S2 S3
                                   b  |       m            i  |             S1 S2 S3
                                   s  | s   s              b  |                      M1 M3
                                   m  |   m   m            p  |                      M1 M3
                                                           S1 | S1 S1       S1 S2 S3
                                                           S2 | S2 S2       S2 S2 S3
                                                           S3 | S3 S3       S3 S3 S3
                                                           M1 |       M1 M1          M1 M3
                                                           M3 |       M3 M3          M3 M3
``

To resolve ambiguities among interval containers
the ['*finer*] container type is chosen as result type.

[endsect][/ Infix operators Symmetric Difference]


['*See also . . .*]
[table
[]
[[[link boost_icl.function_reference.intersection ['*Intersection*]] ]]
[[[link boost_icl.function_reference.subtraction  ['*Subtraction*]]  ]]
[[[link boost_icl.function_reference.addition     ['*Addition*]]     ]]
]
['*Back to section . . .*]
[table
[]
[[[link function_synopsis_table ['*Function Synopsis*]]    ]]
[[[link boost_icl.interface ['*Interface*]]                ]]
]

[endsect][/ Symmetric Difference]