[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Toon-members] TooN/internal operators.hh vector.hh
From: |
Edward Rosten |
Subject: |
[Toon-members] TooN/internal operators.hh vector.hh |
Date: |
Tue, 17 Feb 2009 13:53:07 +0000 |
CVSROOT: /cvsroot/toon
Module name: TooN
Changes by: Edward Rosten <edrosten> 09/02/17 13:53:07
Modified files:
internal : operators.hh vector.hh
Log message:
Moved other ?= operators inside Vector
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/operators.hh?cvsroot=toon&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/vector.hh?cvsroot=toon&r1=1.11&r2=1.12
Patches:
Index: operators.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/operators.hh,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- operators.hh 17 Feb 2009 13:47:30 -0000 1.3
+++ operators.hh 17 Feb 2009 13:53:07 -0000 1.4
@@ -50,42 +50,6 @@
return result;
}
-// operator += Vector
-template<int Size1, typename Precision1, typename Base1,
- int Size2, typename Precision2, typename Base2>
-Vector<Size1, Precision1, Base1>& operator += (Vector<Size1, Precision1,
Base1>& lhs,
- const Vector<Size2, Precision2,
Base2>& rhs){
- SizeMismatch<Size1,Size2>::test(lhs.size(),rhs.size());
- const int s=lhs.size();
- for(int i=0; i<s; i++){
- lhs[i]+=rhs[i];
- }
- return lhs;
-}
-
-// operator -= Vector
-template<int Size1, typename Base1, typename Precision1,
- int Size2, typename Precision2, typename Base2>
-Vector<Size1, Precision1, Base1>& operator -= (Vector<Size1, Precision1,
Base1>& lhs,
- const Vector<Size2, Precision2,
Base2>& rhs){
- SizeMismatch<Size1,Size2>::test(lhs.size(),rhs.size());
- const int s=lhs.size();
- for(int i=0; i<s; i++){
- lhs[i]-=rhs[i];
- }
- return lhs;
-}
-
-// operator *= double
-template<int Size, typename Precision, typename Base>
-Vector<Size, Precision, Base>& operator *= (Vector<Size, Precision, Base>&
lhs, double rhs){
- const int s=lhs.size();
- for(int i=0; i<s; i++){
- lhs[i]*=rhs;
- }
- return lhs;
-}
-
// output operator <<
template <int Size, typename Precision, typename Base>
inline std::ostream& operator<< (std::ostream& os, const
Vector<Size,Precision,Base>& v){
Index: vector.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/vector.hh,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- vector.hh 17 Feb 2009 13:47:30 -0000 1.11
+++ vector.hh 17 Feb 2009 13:53:07 -0000 1.12
@@ -61,12 +61,33 @@
}
- Vector& operator/=(const Precision& rhs)
- {
+ Vector& operator/=(const Precision& rhs) {
for(int i=0; i<Base::size(); i++)
(*this)[i]/=rhs;
return *this;
}
+ Vector& operator*=(const Precision& rhs) {
+ for(int i=0; i<Base::size(); i++)
+ (*this)[i]*=rhs;
+ return *this;
+ }
+
+ template<int Size2, class Precision2, class Base2>
+ Vector& operator+=(const Vector<Size2, Precision2, Base2>& rhs) {
+ SizeMismatch<Size,Size2>::test(Base::size(),rhs.size());
+ for(int i=0; i<Base::size(); i++)
+ (*this)[i]+=rhs;
+ return *this;
+ }
+
+ template<int Size2, class Precision2, class Base2>
+ Vector& operator-=(const Vector<Size2, Precision2, Base2>& rhs) {
+ SizeMismatch<Size,Size2>::test(Base::size(),rhs.size());
+ for(int i=0; i<Base::size(); i++)
+ (*this)[i]-=rhs;
+ return *this;
+ }
+
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Toon-members] TooN/internal operators.hh vector.hh,
Edward Rosten <=