CBMC
Loading...
Searching...
No Matches
Functions
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.
 

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
T value type of the sets
Compare comparison predicate of the sets
Alloc allocator of the sets
Parameters
target first input set, will contain the result of the union
source second input set
Returns
true iff target was changed

Definition at line 28 of file container_utils.h.

AltStyle によって変換されたページ (->オリジナル) /