diff options
author | schnetter <> | 2002-12-12 13:36:00 +0000 |
---|---|---|
committer | schnetter <> | 2002-12-12 13:36:00 +0000 |
commit | 3b8e0a728aee36eda37a8aa13d694478f69c0ff3 (patch) | |
tree | d7a8e25a53441e1f73b1b677675cc8f4ad87c970 /Carpet | |
parent | effff820d40fa8eb7eea522b2a571641c06c2b17 (diff) |
New function "ifthen" that is similar to the operator ?:, except both
New function "ifthen" that is similar to the operator ?:, except both
branches are evaluated.
darcs-hash:20021212133644-07bb3-d7eeab0abe7cf68454cfc52390b676345d88117c.gz
Diffstat (limited to 'Carpet')
-rw-r--r-- | Carpet/CarpetLib/src/vect.hh | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Carpet/CarpetLib/src/vect.hh b/Carpet/CarpetLib/src/vect.hh index 195dc3748..d08f93b2a 100644 --- a/Carpet/CarpetLib/src/vect.hh +++ b/Carpet/CarpetLib/src/vect.hh @@ -5,7 +5,7 @@ copyright : (C) 2000 by Erik Schnetter email : schnetter@astro.psu.edu - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/vect.hh,v 1.11 2002/12/12 12:58:24 schnetter Exp $ + $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/vect.hh,v 1.12 2002/12/12 14:36:44 schnetter Exp $ ***************************************************************************/ @@ -419,13 +419,12 @@ public: return r; } -#if 0 - vect operator?: (const vect& a, const vect& b) const { - vect r(*this); - for (int d=0; d<D; ++d) r[d]=r[d]?a[d]:b[d]; + template<class TT> + vect<TT,D> ifthen (const vect<TT,D>& a, const vect<TT,D>& b) const { + vect<TT,D> r; + for (int d=0; d<D; ++d) r[d]=(*this)[d]?a[d]:b[d]; return r; } -#endif // Iterators #if 0 |