lundi 28 décembre 2020

What's the meaning of "typename" in "typename Rigid2

    template <typename FloatType>
        
    class Rigid2 {
        
    using Vector = Eigen::Matrix<FloatType, 2, 1>;
        
     
        
    template <typename FloatType>
        
    Rigid2<FloatType> operator*(const Rigid2<FloatType>& lhs,
        
                                const Rigid2<FloatType>& rhs) {
        
      return Rigid2<FloatType>(
        
          lhs.rotation() * rhs.translation() + lhs.translation(),
        
          lhs.rotation() * rhs.rotation());
        
    }
        
     
        
    template <typename FloatType>
        
    typename Rigid2<FloatType>::Vector operator*( 
        
        const Rigid2<FloatType>& rigid,
        
        const typename Rigid2<FloatType>::Vector& point) {
        
      return rigid.rotation() * point + rigid.translation();
        
    }
}
        

What's the meaning of the typename in the sentence "typename Rigid2::Vector operator*". Does it to declare the operator* is the second time overloading?
If it does.We must use it to declare the function what overloads second time?

Aucun commentaire:

Enregistrer un commentaire