1 | /* $Id: check_simple_vector.cpp 1612 2009-12-22 13:51:29Z bradbell $ */ |
---|

2 | /* -------------------------------------------------------------------------- |
---|

3 | CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-09 Bradley M. Bell |
---|

4 | |
---|

5 | CppAD is distributed under multiple licenses. This distribution is under |
---|

6 | the terms of the |
---|

7 | Common Public License Version 1.0. |
---|

8 | |
---|

9 | A copy of this license is included in the COPYING file of this distribution. |
---|

10 | Please visit http://www.coin-or.org/CppAD/ for information on other licenses. |
---|

11 | -------------------------------------------------------------------------- */ |
---|

12 | |
---|

13 | # include <cppad/cppad.hpp> |
---|

14 | # include <set> |
---|

15 | # include <vector> |
---|

16 | # include <valarray> |
---|

17 | |
---|

18 | namespace { |
---|

19 | template <class Scalar> |
---|

20 | void Case(const Scalar& x, const Scalar& y) |
---|

21 | { using CppAD::CheckSimpleVector; |
---|

22 | |
---|

23 | CheckSimpleVector<Scalar, CppAD::vector<Scalar> > (x, y); |
---|

24 | CheckSimpleVector<Scalar, std::vector<Scalar> > (x, y); |
---|

25 | CheckSimpleVector<Scalar, std::valarray<Scalar> > (x, y); |
---|

26 | # if CPPAD_BOOSTVECTOR |
---|

27 | typedef boost::numeric::ublas::vector<Scalar> boost_vector; |
---|

28 | CheckSimpleVector<Scalar, boost_vector > (x, y); |
---|

29 | # endif |
---|

30 | } |
---|

31 | } |
---|

32 | bool check_simple_vector(void) |
---|

33 | { // Unusal test in that CheckSimpleVector will abort if an error occurs |
---|

34 | Case(float(0), float(1)); |
---|

35 | Case(double(0), double(1)); |
---|

36 | // |
---|

37 | std::set<size_t> x, y; |
---|

38 | x.insert(1); |
---|

39 | y.insert(2); |
---|

40 | Case(x, y); |
---|

41 | // |
---|

42 | return true; |
---|

43 | } |
---|