| 63 | |
| 64 | template<typename TransformType> |
| 65 | void check_stdvector_transform(const TransformType&) |
| 66 | { |
| 67 | typedef typename TransformType::MatrixType MatrixType; |
| 68 | TransformType x(MatrixType::Random()), y(MatrixType::Random()); |
| 69 | std::vector<TransformType> v(10), w(20, y); |
| 70 | v[5] = x; |
| 71 | w[6] = v[5]; |
| 72 | VERIFY_IS_APPROX(w[6], v[5]); |
| 73 | v = w; |
| 74 | for(int i = 0; i < 20; i++) |
| 75 | { |
| 76 | VERIFY_IS_APPROX(w[i], v[i]); |
| 77 | } |
| 78 | |
| 79 | v.resize(21); |
| 80 | v[20] = x; |
| 81 | VERIFY_IS_APPROX(v[20], x); |
| 82 | v.resize(22,y); |
| 83 | VERIFY_IS_APPROX(v[21], y); |
| 84 | v.push_back(x); |
| 85 | VERIFY_IS_APPROX(v[22], x); |
| 86 | VERIFY((internal::UIntPtr)&(v[22]) == (internal::UIntPtr)&(v[21]) + sizeof(TransformType)); |
| 87 | |
| 88 | // do a lot of push_back such that the vector gets internally resized |
| 89 | // (with memory reallocation) |
| 90 | TransformType* ref = &w[0]; |
| 91 | for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i) |
| 92 | v.push_back(w[i%w.size()]); |
| 93 | for(unsigned int i=23; i<v.size(); ++i) |
| 94 | { |
| 95 | VERIFY(v[i].matrix()==w[(i-23)%w.size()].matrix()); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | template<typename QuaternionType> |
| 100 | void check_stdvector_quaternion(const QuaternionType&) |