Changeset 4137
- Timestamp:
- Jan 21, 2022, 3:02:05 PM (20 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/matrix_view.cc
r4132 r4137 198 198 199 199 200 utility::MatrixView make_view(utility::Matrix& m) 201 { 202 return utility::MatrixView(m); 203 } 204 205 200 206 void test_matrix_view(test::Suite& suite) 201 207 { … … 212 218 test_assignment<MatrixView>(suite, m); 213 219 test_iterators<MatrixView>(suite, m); 220 MatrixView view = make_view(m); 221 } 222 223 224 utility::MatrixConstView make_const_view(const utility::Matrix& m) 225 { 226 return utility::MatrixConstView(m); 214 227 } 215 228 … … 227 240 test_constructors<MatrixConstView>(suite, m); 228 241 test_iterators<MatrixConstView>(suite, m); 229 } 242 243 MatrixConstView view = make_const_view(m); 244 } -
trunk/yat/utility/MatrixView.cc
r4129 r4137 134 134 135 135 136 MatrixView::MatrixView(MatrixView::proxy p) 137 : view_(nullptr) 138 { 139 std::swap(view_, p.view_); 140 } 141 142 143 MatrixView::operator proxy() 144 { 145 return proxy(std::move(view_)); 146 } 147 148 149 MatrixView::proxy::proxy(gsl_matrix_view*&& v) 150 : view_(nullptr) 151 { 152 std::swap(view_, v); 153 } 154 136 155 }}} // of namespace utility, yat and thep -
trunk/yat/utility/MatrixView.h
r4129 r4137 132 132 // x n2 and view(0,0) points to other(k1, k2) 133 133 void copy(gsl_matrix* other, size_t k1, size_t k2, size_t n1, size_t n2); 134 135 136 // See VectorView::proxy for motivation. 137 struct proxy 138 { 139 proxy(void) = delete; 140 proxy(gsl_matrix_view*&& v); 141 gsl_matrix_view* view_; 142 }; 143 144 public: 145 /** 146 \brief create a MatrixView from an internal proxy class. 147 */ 148 MatrixView(proxy p); 149 150 /** 151 Conversion operator to a private proxy class. 152 */ 153 operator proxy(); 134 154 }; 135 155
Note: See TracChangeset
for help on using the changeset viewer.