| 49 | |
| 50 | template<typename TransformType> |
| 51 | void check_stdvector_transform(const TransformType&) |
| 52 | { |
| 53 | typedef typename TransformType::MatrixType MatrixType; |
| 54 | TransformType x(MatrixType::Random()), y(MatrixType::Random()); |
| 55 | std::vector<TransformType,Eigen::aligned_allocator<TransformType> > v(10), w(20, y); |
| 56 | v[5] = x; |
| 57 | w[6] = v[5]; |
| 58 | VERIFY_IS_APPROX(w[6], v[5]); |
| 59 | v = w; |
| 60 | for(int i = 0; i < 20; i++) |
| 61 | { |
| 62 | VERIFY_IS_APPROX(w[i], v[i]); |
| 63 | } |
| 64 | |
| 65 | v.resize(21); |
| 66 | v[20] = x; |
| 67 | VERIFY_IS_APPROX(v[20], x); |
| 68 | v.resize(22,y); |
| 69 | VERIFY_IS_APPROX(v[21], y); |
| 70 | v.push_back(x); |
| 71 | VERIFY_IS_APPROX(v[22], x); |
| 72 | VERIFY((internal::UIntPtr)&(v[22]) == (internal::UIntPtr)&(v[21]) + sizeof(TransformType)); |
| 73 | |
| 74 | // do a lot of push_back such that the vector gets internally resized |
| 75 | // (with memory reallocation) |
| 76 | TransformType* ref = &w[0]; |
| 77 | for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i) |
| 78 | v.push_back(w[i%w.size()]); |
| 79 | for(unsigned int i=23; i<v.size(); ++i) |
| 80 | { |
| 81 | VERIFY(v[i].matrix()==w[(i-23)%w.size()].matrix()); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | template<typename QuaternionType> |
| 86 | void check_stdvector_quaternion(const QuaternionType&) |