Re: [eigen] C++ Syntax Question Regarding Multiple Template<...>

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


My crap attempt at answers, because the questions are interesting not
because I know precisely what I'm talking about.

> 1) Is it necessary to separate the two "template bracket" constructs in the
> definition?

Yes.

> Is this required by the standard and/or is it simply necessary
> to help compilers figure it out?

Required.

>  Would it be valid to put everything in one
> "template bracket", i.e.
>
> template<typename Scalar, int _Options, typename _Index, typename
> InputIterators>?

No.

> Inside the template, would the order matter?

Moot as above answer was no.

> 2) My guess is this issue only arises when there is (1) a nested template
> member of a templated type AND (2) the nested template is declared inside
> the definition of the parent but defined later, outside of its parent's
> definition. Is this correct?

I believe so.

> Is there any other circumstance under which one
> may/must iterate multiple template-bracket constructs?

I'm unaware of any.

> 3) If either the parent template type (in this case SparseMatrix) or the
> child template (setFromTriplets) were fully specialized, would it then be
> necessary to have an empty template-bracket construct to represent the
> missing (i.e. specified) types, as in
>
> template<> template<typename InputIterators> void
> SparseMatrix<double>::setFromTriplets...

I think so, but my knowledge is dodgy here.

> Or is
>
> template<typename InputIterators> void
> SparseMatrix<double>::setFromTriplets... enough?

I think not.

> Is the order restricted; that is, if as in that last example, the parent is
> fully specified but the nested template is not, would it be valid to write
>
> template<typename InputIterators> template<> void
> SparseMatrix<double>::setFromTriplets...?

I think so.

You've now written a good interview question that, with your
permission, I will steal.

- Rhys



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/