MCPcopy Create free account
hub / github.com/davisking/dlib / set_intersection

Function set_intersection

dlib/set_utils/set_utils.h:118–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116 typename V
117 >
118 void set_intersection (
119 const T& a,
120 const U& b,
121 V& i
122 )
123 {
124 typedef typename T::type type;
125 if (is_same_object(a,i) || is_same_object(b,i))
126 {
127 V local_i;
128
129 type temp;
130
131 if (a.size() < b.size())
132 {
133 a.reset();
134 while (a.move_next())
135 {
136 if (b.is_member(a.element()))
137 {
138 temp = a.element();
139 local_i.add(temp);
140 }
141 }
142 }
143 else
144 {
145 b.reset();
146 while (b.move_next())
147 {
148 if (a.is_member(b.element()))
149 {
150 temp = b.element();
151 local_i.add(temp);
152 }
153 }
154 }
155
156 local_i.swap(i);
157 }
158 else
159 {
160 i.clear();
161 type temp;
162
163 if (a.size() < b.size())
164 {
165 a.reset();
166 while (a.move_next())
167 {
168 if (b.is_member(a.element()))
169 {
170 temp = a.element();
171 i.add(temp);
172 }
173 }
174 }
175 else

Callers 2

create_join_treeFunction · 0.85
is_join_treeFunction · 0.85

Calls 7

is_same_objectFunction · 0.50
sizeMethod · 0.45
resetMethod · 0.45
move_nextMethod · 0.45
addMethod · 0.45
swapMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected