void t_subvector( Vector1 vec1, Vector2 vec2, Vector3 vec3, IndexObj1 const& obj1, IndexObj2 const& obj2, IndexObj3 const& obj3) { typedef typename Vector1::value_type T; // Check initial values. check_v(vec1, obj1); check_v(vec2, obj1); check_v(vec3, obj1); // Rotate through values. set_v (vec1, obj2); check_v(vec2, obj2); set_v (vec2, obj3); check_v(vec3, obj3); set_v (vec3, obj1); // Check vector lengths. length_type size = vec1.size(); test_assert(vec1.size() == size); test_assert(vec2.size() == size); test_assert(vec3.size() == size); test_assert(vec1.size(0) == size); test_assert(vec2.size(0) == size); test_assert(vec3.size(0) == size); // Test vector assignment. Vector<T> new1(size); set_v(new1, obj1); Vector<T> new2(size); set_v(new2, obj2); Vector<T> new3(size); set_v(new3, obj3); check_v(vec1, obj1); check_v(vec2, obj1); check_v(vec3, obj1); vec1 = new2; check_v(vec1, obj2); check_v(vec2, obj2); check_v(vec3, obj2); vec2 = new3; check_v(vec1, obj3); check_v(vec2, obj3); check_v(vec3, obj3); vec3 = new1; check_v(vec1, obj1); check_v(vec2, obj1); check_v(vec3, obj1); }
static auto getStrongIdRange2(std::size_t s, const Vector1& existing1, const Vector2& existing2) { std::vector<Id<T>> vec; vec.reserve(s + existing1.size() + existing2.size()); std::transform(existing1.begin(), existing1.end(), std::back_inserter(vec), [] (const auto& elt) { return elt.id(); }); std::transform(existing2.begin(), existing2.end(), std::back_inserter(vec), [] (const auto& elt) { return elt->id(); }); for(; s --> 0 ;) { vec.push_back(getStrongId(vec)); } auto final = std::vector<Id<T>>(vec.begin() + existing1.size() + existing2.size(), vec.end()); return final; }
bool CheckEqualVector(const Vector1 &vector1, const Vector2 &vector2) { if(vector1.size() != vector2.size()) return false; return std::equal(vector1.begin(), vector1.end(), vector2.begin()); }