mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Write page on template and typename keywords in C++.
After yet another question on the forum, I decided to write something on this common issue. Now we just need to link to this and get people to read it. Thanks to mattb on the forum for some links. Caveat: IANALL (I am not a language lawyer).
This commit is contained in:
@@ -110,7 +110,7 @@ Iterating over the coefficients of a sparse matrix can be done only in the same
|
||||
<tr><td>
|
||||
\code
|
||||
SparseMatrixType mat(rows,cols);
|
||||
for (int k=0; k<m1.outerSize(); ++k)
|
||||
for (int k=0; k<mat.outerSize(); ++k)
|
||||
for (SparseMatrixType::InnerIterator it(mat,k); it; ++it)
|
||||
{
|
||||
it.value();
|
||||
@@ -131,6 +131,9 @@ for (SparseVector<double>::InnerIterator it(vec); it; ++it)
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
If the type of the sparse matrix or vector depends on a template parameter, then the \c typename keyword is
|
||||
required to indicate that \c InnerIterator denotes a type; see \ref TopicTemplateKeyword for details.
|
||||
|
||||
|
||||
\section TutorialSparseFilling Filling a sparse matrix
|
||||
|
||||
|
||||
Reference in New Issue
Block a user