C++ (Qt)namespace Impl{ template<class ContainerIterator>class Iterator{ using ValueType = typename std::iterator_traits<ContainerIterator>::value_type;public: Iterator(const ContainerIterator& begin, const ContainerIterator& end) : begin_(begin), end_(end) {} bool atEnd() const{ return begin_ == end_; } bool hasNext() const{ return begin_ != end_; } ValueType& operator++(){ return next(); } ValueType operator++() const{ return next(); } ValueType& next(){ return *(++begin_); } ValueType next() const{ return *(++begin_); } ValueType& operator*(){ return *begin_; } ValueType operator*() const{ return *begin_; } private: ContainerIterator begin_; ContainerIterator end_;}; }template<class Container>class Iterator: public Impl::Iterator<typename Container::iterator>{public: explicit Iterator(Container& container) : Impl::Iterator<typename Container::iterator>(container.begin(), container.end()) { } }; template<class Container>class ConstIterator: public Impl::Iterator<typename Container::const_iterator>{public: explicit ConstIterator(const Container& container) : Impl::Iterator<typename Container::const_iterator>(container.begin(), container.end()) { } }; template<class Container>auto makeIterator(Container& container) -> Iterator<Container>{ return Iterator<Container>(container);} template<class Container>auto makeIterator(const Container& container) -> ConstIterator<Container>{ return ConstIterator<Container>(container);} template<class Container>auto makeConstIterator(const Container& container) -> ConstIterator<Container>{ return ConstIterator<Container>(container);}
C++ (Qt)QVector<double> xNodes; // x coordinates arrayQVector<double> yNodes; // y coordinates arrayQVector<double> zNodes; // z coordinates arrayQMatrix3x3 rotMatrix; // rotation matrix/*......*/for (auto itX = makeIterator(xNodes), itY = makeIterator(yNodes), itZ = makeIterator(zNodes); itX.hasNext() && itY.hasNext() && itZ.hasNext(); ++itX, ++itY, ++itZ){ rotateVertex(rotMatrix, *itX, *itY, *itZ);}
C++ (Qt)for (auto itX = makeIterator(xNodes), itY = makeIterator(yNodes), itZ = makeIterator(zNodes); itX.hasNext() && itY.hasNext() && itZ.hasNext(); ++itX, ++itY, ++itZ){ rotateVertex(rotMatrix, *itX, *itY, *itZ);}
C++ (Qt)for (auto itX = xNodes.begin(), itY = yNodes.begin(), itZ = zNodes.begin(); itX !=xNodes.end(); ++itX, ++itY, ++itZ){ rotateVertex(rotMatrix, *itX, *itY, *itZ);}
C++ (Qt)for (auto itX = xNodes.begin(), itY = yNodes.begin(), itZ = zNodes.begin(); itX !=xNodes.end() && itY != yNodes.end() && itZ != zNodes.end(); ++itX, ++itY, ++itZ){ rotateVertex(rotMatrix, *itX, *itY, *itZ);}
C++ (Qt)size_t limit = qMin(qMin(xNodes.size(), yNodes.size()), zNodes.size());for (size_t i = 0; i < limit; ++i) rotateVertex(rotMatrix, xNodes[i], yNodes[i], zNodes[i]);
C++ (Qt)for (auto itX = xNodes.begin(), itY = yNodes.begin(), itZ = zNodes.begin(), xEnd = xNodes.end(), yEnd = yNodes.end(), zEnd = zNodes.end(); itX != xEnd && itY != yEnd && itZ != zEnd; ++itX, ++itY, ++itZ){ rotateVertex(rotMatrix, *itX, *itY, *itZ);}
C++ (Qt)std::copy(v.begin(), v.end(), res.begin()); // res.end() не передаём