|
-
January 19th, 2009, 08:20 AM
#1
what is that I have to define to use += or *=?
std::map<unsigned int,std::vector<std::vector<double> > > normal;
std::map<unsigned int, std::vector<std::vector<double> > >::iterator it_Set;
for(it_Set = mSetContactNormals.begin(); it_Set != mSetContactNormals.end(); ++it_Set)
{
std::vector<std::vector<double> > vectorSet(it_Set->second);
std::vector<std::vector<double> >::iterator it_vs;
Vector<double> ac_normal(3,0.00);
for(it_vs = vectorSet.begin(); it_vs != vectorSet.end(); ++it_vs)
{
Vector<double> normal_in_set(*it_vs);
ac_normal += normal_in_set; // error here
}
ac_normal *= (1.00/sqrt(std::inner_product(ac_normal.begin(),ac_normal.end(),ac_normal.begin(),0.00))); //errors 1,2
mContactNormals[it_Set->first] = ac_normal; //3
}
1-error C2784: 'class std::complex<_Ty> &__cdecl std: perator *=(class std::complex<_Ty> &,const class std::complex<_U> &)' : could not deduce template argument for 'cl
*** std::complex<_Ty> &' from 'class std::vector<double,class std::allocator<double> >'
2-error C2676: binary '*=' : 'class std::vector<double,class std::allocator<double> >' does not define this operator or a conversion to a type acceptable to the predefin
ed operator
3-error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'double' (or there is no acceptable conversion)
-
January 19th, 2009, 08:34 AM
#2
Re: what is that I have to define to use += or *=?
Please post your code in [code][/code] forum bbcode tags.
 Originally Posted by jhendrix
what is that I have to define to use += or *=?
You would need to overload operator+= and operator*= respectively.
What is a Vector<double>? It looks like it should be some class defined by you, but the error messages hint that it is a std::vector<double> instead. You might want to post the smallest and simplest program that demonstrates the errors.
-
January 19th, 2009, 08:44 AM
#3
Re: what is that I have to define to use += or *=?
Yes, without code tags, the post is always UNCLEAR, it is advisable to always c.learify code snips with code tags to release eyes strain and more
All the best 
-Kim Tu
-
January 19th, 2009, 09:40 AM
#4
Re: what is that I have to define to use += or *=?
Thanks to both of you, I've solved first two errors but the third is still appearing,
mContactNormals[it_Set->first] = ac_normal;
error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'double'
thanks
-
January 19th, 2009, 09:42 AM
#5
Re: what is that I have to define to use += or *=?
Exactly as the error says. mContactNormals[it_Set->first] is not of the same type as ac_normal.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|