| 43 | |
| 44 | template<typename MatrixType> |
| 45 | void check_stdlist_matrix(const MatrixType& m) |
| 46 | { |
| 47 | typename MatrixType::Index rows = m.rows(); |
| 48 | typename MatrixType::Index cols = m.cols(); |
| 49 | MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols); |
| 50 | std::list<MatrixType> v(10, MatrixType(rows,cols)), w(20, y); |
| 51 | typename std::list<MatrixType>::iterator itv = get(v, 5); |
| 52 | typename std::list<MatrixType>::iterator itw = get(w, 6); |
| 53 | *itv = x; |
| 54 | *itw = *itv; |
| 55 | VERIFY_IS_APPROX(*itw, *itv); |
| 56 | v = w; |
| 57 | itv = v.begin(); |
| 58 | itw = w.begin(); |
| 59 | for(int i = 0; i < 20; i++) |
| 60 | { |
| 61 | VERIFY_IS_APPROX(*itw, *itv); |
| 62 | ++itv; |
| 63 | ++itw; |
| 64 | } |
| 65 | |
| 66 | v.resize(21); |
| 67 | set(v, 20, x); |
| 68 | VERIFY_IS_APPROX(*get(v, 20), x); |
| 69 | v.resize(22,y); |
| 70 | VERIFY_IS_APPROX(*get(v, 21), y); |
| 71 | v.push_back(x); |
| 72 | VERIFY_IS_APPROX(*get(v, 22), x); |
| 73 | |
| 74 | // do a lot of push_back such that the list gets internally resized |
| 75 | // (with memory reallocation) |
| 76 | MatrixType* ref = &(*get(w, 0)); |
| 77 | for(int i=0; i<30 || ((ref==&(*get(w, 0))) && i<300); ++i) |
| 78 | v.push_back(*get(w, i%w.size())); |
| 79 | for(unsigned int i=23; i<v.size(); ++i) |
| 80 | { |
| 81 | VERIFY((*get(v, i))==(*get(w, (i-23)%w.size()))); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | template<typename TransformType> |
| 86 | void check_stdlist_transform(const TransformType&) |