|
Prev
| Next
|
|
|
|
|
|
set_union.cpp |
Headings |
@(@\newcommand{\W}[1]{ \; #1 \; }
\newcommand{\R}[1]{ {\rm #1} }
\newcommand{\B}[1]{ {\bf #1} }
\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }
\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }
\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }
\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@
This is cppad-20221105 documentation. Here is a link to its
current documentation
.
Set Union: Example and Test
# include <cppad/utility/set_union.hpp>
bool set_union(void)
{ bool ok = true;
// create empty sets
std::set<size_t> left, right, result;
// set left = {1, 2}
left.insert(1);
left.insert(2);
// set right = {2, 3}
right.insert(2);
right.insert(3);
// set result = {1, 2} U {2, 3}
result = CppAD::set_union(left, right);
// expected result
size_t check_vec[] = {1, 2, 3};
std::set<size_t> check_set(check_vec, check_vec + 3);
// check result
ok &= result == check_set;
return ok;
}
Input File: example/utility/set_union.cpp