CBMC
container_utils.h File Reference
#include <set>
+ Include dependency graph for container_utils.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<class T , class Compare , class Alloc >
bool util_inplace_set_union (std::set< T, Compare, Alloc > &target, const std::set< T, Compare, Alloc > &source)
 Compute union of two sets. More...
 

Function Documentation

◆ util_inplace_set_union()

template<class T , class Compare , class Alloc >
bool util_inplace_set_union ( std::set< T, Compare, Alloc > &  target,
const std::set< T, Compare, Alloc > &  source 
)

Compute union of two sets.

This function has complexity O(max(n1, n2)), with n1, n2 being the sizes of the sets of which the union is formed. This is in contrast to target.insert(source.begin(), source.end()) which has complexity O(n2 * log(n1 + n2)).

Template Parameters
Tvalue type of the sets
Comparecomparison predicate of the sets
Allocallocator of the sets
Parameters
targetfirst input set, will contain the result of the union
sourcesecond input set
Returns
true iff target was changed

Definition at line 28 of file container_utils.h.