Prev Next Index-> contents reference index search external Up-> CppAD utility set_union set_union.cpp CppAD-> Install Introduction AD ADFun preprocessor multi_thread utility ipopt_solve Example speed Appendix utility-> ErrorHandler NearEqual speed_test SpeedTest time_test test_boolofvoid NumericType CheckNumericType SimpleVector CheckSimpleVector nan pow_int Poly LuDetAndSolve RombergOne RombergMul Runge45 Rosen34 OdeErrControl OdeGear OdeGearControl CppAD_vector thread_alloc index_sort to_string set_union sparse_rc sparse_rcv set_union-> set_union.cpp 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}} }$
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