📄 strided_dense_el_iterator.hpp
字号:
// Software License for MTL// // Copyright (c) 2007 The Trustees of Indiana University. All rights reserved.// Authors: Peter Gottschling and Andrew Lumsdaine// // This file is part of the Matrix Template Library// // See also license.mtl.txt in the distribution.#ifndef MTL_STRIDED_DENSE_EL_ITERATOR_INCLUDE#define MTL_STRIDED_DENSE_EL_ITERATOR_INCLUDE#include <boost/numeric/mtl/mtl_fwd.hpp>#include <boost/numeric/mtl/detail/strided_base_cursor.hpp>namespace mtl {/// Iterator going in strides over element of matrix, matrix row/column, or vector/** - Strided iterator *operator returns (const) reference to Value instead of key - row(i) and col(i) don't work **/template <typename Value>struct strided_dense_el_const_iterator : public detail::strided_base_cursor<const Value*> { typedef const Value* key_type; typedef detail::strided_base_cursor<key_type> super; typedef strided_dense_el_const_iterator self; strided_dense_el_const_iterator(key_type me, size_t stride) : super(me, stride) {} template <typename Parameters> strided_dense_el_const_iterator(mtl::dense2D<Value, Parameters> const& ma, size_t r, size_t c, size_t stride) : super(ma.elements() + ma.indexer(ma, r, c), stride) {} self operator+(int x) const { return super::operator+(x); } const Value& operator*() const { return *(this->key); }};/// Iterator going in strides over element of matrix, matrix row/column, or vector/** - Strided iterator *operator returns (const) reference to Value instead of key - row(i) and col(i) don't work **/template <typename Value>struct strided_dense_el_iterator : public detail::strided_base_cursor<Value*> { typedef Value* key_type; typedef detail::strided_base_cursor<key_type> super; typedef strided_dense_el_iterator self; strided_dense_el_iterator(key_type me, size_t stride) : super(me, stride) {} template <typename Parameters> strided_dense_el_iterator(mtl::dense2D<Value, Parameters>& ma, size_t r, size_t c, size_t stride) : super(ma.elements() + ma.indexer(ma, r, c), stride) {} self operator+(int x) const { self tmp(*this); tmp+= x; return tmp; } Value& operator*() const { return *(this->key); }};} // namespace mtl#endif // MTL_STRIDED_DENSE_EL_ITERATOR_INCLUDE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -