3

I am learning a header file about Eigen library. In a definition of class like below:

class Utility
{
  public:
    template <typename Derived>
    static Eigen::Quaternion<typename Derived::Scalar> deltaQ(const Eigen::MatrixBase<Derived> &theta)
    {
        typedef typename Derived::Scalar Scalar_t;

        Eigen::Quaternion<Scalar_t> dq;
        ...

I know that "Derived" is a Template Data Type, and the parameter of function "deltaQ" uses it:

<Derived>

But what is the meaning of the function return type:

<typename Derived::Scalar>

mean? I can not find out the usage like this, and is it some special C++ technology? Thank you very much!

Jay
  • 31
  • 3
  • [Where and why do I have to put the “template” and “typename” keywords?](https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords) – WhozCraig May 22 '19 at 06:33
  • The return type is `Eigen::Quaternion`. – molbdnilo May 22 '19 at 06:48

0 Answers0