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:
Jitse Niesen
2011-09-10 09:18:18 +01:00
parent 3e7aaadb1d
commit 59b83c14fd
6 changed files with 189 additions and 1 deletions

View File

@@ -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