Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

template function Ambiguity.

0 views
Skip to first unread message

FE

unread,
Aug 14, 2010, 7:37:16 PM8/14/10
to
I developed class vector and class matrix use mingw gcc.
then move to vs 2008 get Problem:

template<class TYPE,int DIM=3>
class Vector
..........
template<class TYPE,int COL=4,int ROW=4>
class Matrix
.............

when call Vector<double,4>*Matrix<double,4,4>

Ambiguity in
template<class TYPE,int COL,int ROW>
Vector<TYPE,COL> operator*(Vector<TYPE,ROW>&v,Matrix<TYPE,COL,ROW>
const&m)
and
template<class TYPE,int DIM,class SCALETYPE>
Vector<TYPE,DIM> operator*(Vector<TYPE,DIM> const&v,SCALETYPE t)

vs2008 bug or Correct?(mingw gcc is pass).
how can I Solve this and don't loss Flexibility on operator*?

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

red floyd

unread,
Aug 17, 2010, 8:16:25 PM8/17/10
to
On Aug 14, 4:37 pm, FE <blood_...@sina.com.cn> wrote:
> I developed class vector and class matrix use mingw gcc.
> then move to vs 2008 get Problem:
>
> template<class TYPE,int DIM=3>
> class Vector
> ..........
> template<class TYPE,int COL=4,int ROW=4>
> class Matrix
> .............
>
> when call Vector<double,4>*Matrix<double,4,4>
>
> Ambiguity in
> template<class TYPE,int COL,int ROW>
> Vector<TYPE,COL> operator*(Vector<TYPE,ROW>&v,Matrix<TYPE,COL,ROW>
> const&m)
> and
> template<class TYPE,int DIM,class SCALETYPE>
> Vector<TYPE,DIM> operator*(Vector<TYPE,DIM> const&v,SCALETYPE t)
>
> vs2008 bug or Correct?(mingw gcc is pass).
> how can I Solve this and don't loss Flexibility on operator*?

You have an error on line 42 of your code.

We have no idea what any of the code in question looks like, and
we're not mind readers.

Please post a minimal, *COMPILABLE* (yes, one that generates
the error above is fine) example that exhibits the behavior in
question.

Please see the FAQ, in particular FAQ 5.8

http://www.parashift.com/c++-faq-lite

0 new messages