This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

templ decl for non-templ ?



>>>>> "Kurt" == Kurt Garloff <garloff@hft.e-technik.uni-dortmund.de> writes:

    Kurt> Hi,

    Kurt> here comes a message that I don't understand ...

    Kurt> template <typename T, unsigned rank> class tensor {
    Kurt> protected: T* data; public: tensor () : data (0) {}; tensor
    Kurt> (const tensor<T, rank>& t) : data (t.data) {};
   
    Kurt>    template <unsigned r1> tensor <T, rank + r1> operator *
    Kurt> (const tensor <T, r1>& ) const; };

    Kurt> template <typename T, unsigned rank, unsigned r1> tensor<T,
    Kurt> rank+r1> tensor<T, rank>::operator * (const tensor <T, r1>&
    Kurt> t1) const { tensor <T, rank+r1> tr; return tr; };
     
    Kurt> int main () { tensor <double, 2> t1; tensor <double, 3> t2;
    Kurt> tensor <double, 5> (t1 * t2); };


You have to write this:

template <typename T, unsigned rank>
template <unsigned r1>
tensor<T, rank + r1> ...

Note the two separate template clauses.  However, you will run into
the bug you reported below: things like T<X + 1> are currently causing
name-mangling problems.  I'll be working on this sometime relatively soon.

-- 
Mark Mitchell		mmitchell@usa.net
Stanford University	http://www.stanford.edu



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]