STYLE: modernize code for FieldFunctions (#1160)

- use forwarding tmp factory methods, auto types
This commit is contained in:
Mark Olesen
2019-01-10 17:06:04 +01:00
parent 35fc2d1be2
commit 3019f30b12
3 changed files with 142 additions and 146 deletions

View File

@ -560,9 +560,9 @@ Foam::Field<Type>::component
const direction d const direction d
) const ) const
{ {
tmp<Field<cmptType>> Component(new Field<cmptType>(this->size())); auto tres = tmp<Field<cmptType>>::New(this->size());
::Foam::component(Component.ref(), *this, d); ::Foam::component(tres.ref(), *this, d);
return Component; return tres;
} }
@ -618,9 +618,9 @@ VSForm Foam::Field<Type>::block(const label start) const
template<class Type> template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::Field<Type>::T() const Foam::tmp<Foam::Field<Type>> Foam::Field<Type>::T() const
{ {
tmp<Field<Type>> transpose(new Field<Type>(this->size())); auto tres = tmp<Field<cmptType>>::New(this->size());
::Foam::T(transpose.ref(), *this); ::Foam::T(tres.ref(), *this);
return transpose; return tres;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2019 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -83,12 +83,12 @@ pow
) )
{ {
typedef typename powProduct<Type, r>::type powProductType; typedef typename powProduct<Type, r>::type powProductType;
tmp<Field<powProductType>> tRes auto tres
( (
new Field<powProductType>(f.size()) tmp<Field<powProductType>>::New(f.size())
); );
pow<Type, r>(tRes.ref(), f); pow<Type, r>(tres.ref(), f);
return tRes; return tres;
} }
template<class Type, direction r> template<class Type, direction r>
@ -100,10 +100,10 @@ pow
) )
{ {
typedef typename powProduct<Type, r>::type powProductType; typedef typename powProduct<Type, r>::type powProductType;
tmp<Field<powProductType>> tRes = reuseTmp<powProductType, Type>::New(tf); auto tres = reuseTmp<powProductType, Type>::New(tf);
pow<Type, r>(tRes.ref(), tf()); pow<Type, r>(tres.ref(), tf());
tf.clear(); tf.clear();
return tRes; return tres;
} }
@ -123,12 +123,12 @@ tmp<Field<typename outerProduct<Type, Type>::type>>
sqr(const UList<Type>& f) sqr(const UList<Type>& f)
{ {
typedef typename outerProduct<Type, Type>::type outerProductType; typedef typename outerProduct<Type, Type>::type outerProductType;
tmp<Field<outerProductType>> tRes auto tres
( (
new Field<outerProductType>(f.size()) tmp<Field<outerProductType>>::New(f.size())
); );
sqr(tRes.ref(), f); sqr(tres.ref(), f);
return tRes; return tres;
} }
template<class Type> template<class Type>
@ -136,11 +136,10 @@ tmp<Field<typename outerProduct<Type, Type>::type>>
sqr(const tmp<Field<Type>>& tf) sqr(const tmp<Field<Type>>& tf)
{ {
typedef typename outerProduct<Type, Type>::type outerProductType; typedef typename outerProduct<Type, Type>::type outerProductType;
tmp<Field<outerProductType>> tRes = auto tres = reuseTmp<outerProductType, Type>::New(tf);
reuseTmp<outerProductType, Type>::New(tf); sqr(tres.ref(), tf());
sqr(tRes.ref(), tf());
tf.clear(); tf.clear();
return tRes; return tres;
} }
@ -153,18 +152,18 @@ void magSqr(Field<scalar>& res, const UList<Type>& f)
template<class Type> template<class Type>
tmp<Field<scalar>> magSqr(const UList<Type>& f) tmp<Field<scalar>> magSqr(const UList<Type>& f)
{ {
tmp<Field<scalar>> tRes(new Field<scalar>(f.size())); auto tres = tmp<Field<scalar>>::New(f.size());
magSqr(tRes.ref(), f); magSqr(tres.ref(), f);
return tRes; return tres;
} }
template<class Type> template<class Type>
tmp<Field<scalar>> magSqr(const tmp<Field<Type>>& tf) tmp<Field<scalar>> magSqr(const tmp<Field<Type>>& tf)
{ {
tmp<Field<scalar>> tRes = reuseTmp<scalar, Type>::New(tf); auto tres = reuseTmp<scalar, Type>::New(tf);
magSqr(tRes.ref(), tf()); magSqr(tres.ref(), tf());
tf.clear(); tf.clear();
return tRes; return tres;
} }
@ -177,18 +176,18 @@ void mag(Field<scalar>& res, const UList<Type>& f)
template<class Type> template<class Type>
tmp<Field<scalar>> mag(const UList<Type>& f) tmp<Field<scalar>> mag(const UList<Type>& f)
{ {
tmp<Field<scalar>> tRes(new Field<scalar>(f.size())); auto tres = tmp<Field<scalar>>::New(f.size());
mag(tRes.ref(), f); mag(tres.ref(), f);
return tRes; return tres;
} }
template<class Type> template<class Type>
tmp<Field<scalar>> mag(const tmp<Field<Type>>& tf) tmp<Field<scalar>> mag(const tmp<Field<Type>>& tf)
{ {
tmp<Field<scalar>> tRes = reuseTmp<scalar, Type>::New(tf); auto tres = reuseTmp<scalar, Type>::New(tf);
mag(tRes.ref(), tf()); mag(tres.ref(), tf());
tf.clear(); tf.clear();
return tRes; return tres;
} }
@ -203,19 +202,19 @@ template<class Type>
tmp<Field<typename Field<Type>::cmptType>> cmptMax(const UList<Type>& f) tmp<Field<typename Field<Type>::cmptType>> cmptMax(const UList<Type>& f)
{ {
typedef typename Field<Type>::cmptType cmptType; typedef typename Field<Type>::cmptType cmptType;
tmp<Field<cmptType>> tRes(new Field<cmptType>(f.size())); auto tres = tmp<Field<cmptType>>::New(f.size());
cmptMax(tRes.ref(), f); cmptMax(tres.ref(), f);
return tRes; return tres;
} }
template<class Type> template<class Type>
tmp<Field<typename Field<Type>::cmptType>> cmptMax(const tmp<Field<Type>>& tf) tmp<Field<typename Field<Type>::cmptType>> cmptMax(const tmp<Field<Type>>& tf)
{ {
typedef typename Field<Type>::cmptType cmptType; typedef typename Field<Type>::cmptType cmptType;
tmp<Field<cmptType>> tRes = reuseTmp<cmptType, Type>::New(tf); auto tres = reuseTmp<cmptType, Type>::New(tf);
cmptMax(tRes.ref(), tf()); cmptMax(tres.ref(), tf());
tf.clear(); tf.clear();
return tRes; return tres;
} }
@ -230,19 +229,19 @@ template<class Type>
tmp<Field<typename Field<Type>::cmptType>> cmptMin(const UList<Type>& f) tmp<Field<typename Field<Type>::cmptType>> cmptMin(const UList<Type>& f)
{ {
typedef typename Field<Type>::cmptType cmptType; typedef typename Field<Type>::cmptType cmptType;
tmp<Field<cmptType>> tRes(new Field<cmptType>(f.size())); auto tres = tmp<Field<cmptType>>::New(f.size());
cmptMin(tRes.ref(), f); cmptMin(tres.ref(), f);
return tRes; return tres;
} }
template<class Type> template<class Type>
tmp<Field<typename Field<Type>::cmptType>> cmptMin(const tmp<Field<Type>>& tf) tmp<Field<typename Field<Type>::cmptType>> cmptMin(const tmp<Field<Type>>& tf)
{ {
typedef typename Field<Type>::cmptType cmptType; typedef typename Field<Type>::cmptType cmptType;
tmp<Field<cmptType>> tRes = reuseTmp<cmptType, Type>::New(tf); auto tres = reuseTmp<cmptType, Type>::New(tf);
cmptMin(tRes.ref(), tf()); cmptMin(tres.ref(), tf());
tf.clear(); tf.clear();
return tRes; return tres;
} }
@ -257,19 +256,19 @@ template<class Type>
tmp<Field<typename Field<Type>::cmptType>> cmptAv(const UList<Type>& f) tmp<Field<typename Field<Type>::cmptType>> cmptAv(const UList<Type>& f)
{ {
typedef typename Field<Type>::cmptType cmptType; typedef typename Field<Type>::cmptType cmptType;
tmp<Field<cmptType>> tRes(new Field<cmptType>(f.size())); auto tres = tmp<Field<cmptType>>::New(f.size());
cmptAv(tRes.ref(), f); cmptAv(tres.ref(), f);
return tRes; return tres;
} }
template<class Type> template<class Type>
tmp<Field<typename Field<Type>::cmptType>> cmptAv(const tmp<Field<Type>>& tf) tmp<Field<typename Field<Type>::cmptType>> cmptAv(const tmp<Field<Type>>& tf)
{ {
typedef typename Field<Type>::cmptType cmptType; typedef typename Field<Type>::cmptType cmptType;
tmp<Field<cmptType>> tRes = reuseTmp<cmptType, Type>::New(tf); auto tres = reuseTmp<cmptType, Type>::New(tf);
cmptAv(tRes.ref(), tf()); cmptAv(tres.ref(), tf());
tf.clear(); tf.clear();
return tRes; return tres;
} }
@ -282,18 +281,18 @@ void cmptMag(Field<Type>& res, const UList<Type>& f)
template<class Type> template<class Type>
tmp<Field<Type>> cmptMag(const UList<Type>& f) tmp<Field<Type>> cmptMag(const UList<Type>& f)
{ {
tmp<Field<Type>> tRes(new Field<Type>(f.size())); auto tres = tmp<Field<Type>>::New(f.size());
cmptMag(tRes.ref(), f); cmptMag(tres.ref(), f);
return tRes; return tres;
} }
template<class Type> template<class Type>
tmp<Field<Type>> cmptMag(const tmp<Field<Type>>& tf) tmp<Field<Type>> cmptMag(const tmp<Field<Type>>& tf)
{ {
tmp<Field<Type>> tRes = New(tf); auto tres = New(tf);
cmptMag(tRes.ref(), tf()); cmptMag(tres.ref(), tf());
tf.clear(); tf.clear();
return tRes; return tres;
} }
@ -652,9 +651,9 @@ tmp<Field<typename product<Type1, Type2>::type>> \
operator Op(const UList<Type1>& f1, const UList<Type2>& f2) \ operator Op(const UList<Type1>& f1, const UList<Type2>& f2) \
{ \ { \
typedef typename product<Type1, Type2>::type productType; \ typedef typename product<Type1, Type2>::type productType; \
tmp<Field<productType>> tRes(new Field<productType>(f1.size())); \ auto tres = tmp<Field<productType>>::New(f1.size()); \
OpFunc(tRes.ref(), f1, f2); \ OpFunc(tres.ref(), f1, f2); \
return tRes; \ return tres; \
} \ } \
\ \
template<class Type1, class Type2> \ template<class Type1, class Type2> \
@ -662,10 +661,10 @@ tmp<Field<typename product<Type1, Type2>::type>> \
operator Op(const UList<Type1>& f1, const tmp<Field<Type2>>& tf2) \ operator Op(const UList<Type1>& f1, const tmp<Field<Type2>>& tf2) \
{ \ { \
typedef typename product<Type1, Type2>::type productType; \ typedef typename product<Type1, Type2>::type productType; \
tmp<Field<productType>> tRes = reuseTmp<productType, Type2>::New(tf2); \ auto tres = reuseTmp<productType, Type2>::New(tf2); \
OpFunc(tRes.ref(), f1, tf2()); \ OpFunc(tres.ref(), f1, tf2()); \
tf2.clear(); \ tf2.clear(); \
return tRes; \ return tres; \
} \ } \
\ \
template<class Type1, class Type2> \ template<class Type1, class Type2> \
@ -673,10 +672,10 @@ tmp<Field<typename product<Type1, Type2>::type>> \
operator Op(const tmp<Field<Type1>>& tf1, const UList<Type2>& f2) \ operator Op(const tmp<Field<Type1>>& tf1, const UList<Type2>& f2) \
{ \ { \
typedef typename product<Type1, Type2>::type productType; \ typedef typename product<Type1, Type2>::type productType; \
tmp<Field<productType>> tRes = reuseTmp<productType, Type1>::New(tf1); \ auto tres = reuseTmp<productType, Type1>::New(tf1); \
OpFunc(tRes.ref(), tf1(), f2); \ OpFunc(tres.ref(), tf1(), f2); \
tf1.clear(); \ tf1.clear(); \
return tRes; \ return tres; \
} \ } \
\ \
template<class Type1, class Type2> \ template<class Type1, class Type2> \
@ -684,12 +683,11 @@ tmp<Field<typename product<Type1, Type2>::type>> \
operator Op(const tmp<Field<Type1>>& tf1, const tmp<Field<Type2>>& tf2) \ operator Op(const tmp<Field<Type1>>& tf1, const tmp<Field<Type2>>& tf2) \
{ \ { \
typedef typename product<Type1, Type2>::type productType; \ typedef typename product<Type1, Type2>::type productType; \
tmp<Field<productType>> tRes = \ auto tres = reuseTmpTmp<productType, Type1, Type1, Type2>::New(tf1, tf2); \
reuseTmpTmp<productType, Type1, Type1, Type2>::New(tf1, tf2); \ OpFunc(tres.ref(), tf1(), tf2()); \
OpFunc(tRes.ref(), tf1(), tf2()); \
tf1.clear(); \ tf1.clear(); \
tf2.clear(); \ tf2.clear(); \
return tRes; \ return tres; \
} \ } \
\ \
template<class Type, class Form, class Cmpt, direction nCmpt> \ template<class Type, class Form, class Cmpt, direction nCmpt> \
@ -710,9 +708,9 @@ tmp<Field<typename product<Type, Form>::type>> \
operator Op(const UList<Type>& f1, const VectorSpace<Form,Cmpt,nCmpt>& vs) \ operator Op(const UList<Type>& f1, const VectorSpace<Form,Cmpt,nCmpt>& vs) \
{ \ { \
typedef typename product<Type, Form>::type productType; \ typedef typename product<Type, Form>::type productType; \
tmp<Field<productType>> tRes(new Field<productType>(f1.size())); \ auto tres = tmp<Field<productType>>::New(f1.size()); \
OpFunc(tRes.ref(), f1, static_cast<const Form&>(vs)); \ OpFunc(tres.ref(), f1, static_cast<const Form&>(vs)); \
return tRes; \ return tres; \
} \ } \
\ \
template<class Type, class Form, class Cmpt, direction nCmpt> \ template<class Type, class Form, class Cmpt, direction nCmpt> \
@ -724,10 +722,10 @@ operator Op \
) \ ) \
{ \ { \
typedef typename product<Type, Form>::type productType; \ typedef typename product<Type, Form>::type productType; \
tmp<Field<productType>> tRes = reuseTmp<productType, Type>::New(tf1); \ auto tres = reuseTmp<productType, Type>::New(tf1); \
OpFunc(tRes.ref(), tf1(), static_cast<const Form&>(vs)); \ OpFunc(tres.ref(), tf1(), static_cast<const Form&>(vs)); \
tf1.clear(); \ tf1.clear(); \
return tRes; \ return tres; \
} \ } \
\ \
template<class Form, class Cmpt, direction nCmpt, class Type> \ template<class Form, class Cmpt, direction nCmpt, class Type> \
@ -748,9 +746,9 @@ tmp<Field<typename product<Form, Type>::type>> \
operator Op(const VectorSpace<Form,Cmpt,nCmpt>& vs, const UList<Type>& f1) \ operator Op(const VectorSpace<Form,Cmpt,nCmpt>& vs, const UList<Type>& f1) \
{ \ { \
typedef typename product<Form, Type>::type productType; \ typedef typename product<Form, Type>::type productType; \
tmp<Field<productType>> tRes(new Field<productType>(f1.size())); \ auto tres = tmp<Field<productType>>::New(f1.size()); \
OpFunc(tRes.ref(), static_cast<const Form&>(vs), f1); \ OpFunc(tres.ref(), static_cast<const Form&>(vs), f1); \
return tRes; \ return tres; \
} \ } \
\ \
template<class Form, class Cmpt, direction nCmpt, class Type> \ template<class Form, class Cmpt, direction nCmpt, class Type> \
@ -761,10 +759,10 @@ operator Op \
) \ ) \
{ \ { \
typedef typename product<Form, Type>::type productType; \ typedef typename product<Form, Type>::type productType; \
tmp<Field<productType>> tRes = reuseTmp<productType, Type>::New(tf1); \ auto tres = reuseTmp<productType, Type>::New(tf1); \
OpFunc(tRes.ref(), static_cast<const Form&>(vs), tf1()); \ OpFunc(tres.ref(), static_cast<const Form&>(vs), tf1()); \
tf1.clear(); \ tf1.clear(); \
return tRes; \ return tres; \
} }
PRODUCT_OPERATOR(typeOfSum, +, add) PRODUCT_OPERATOR(typeOfSum, +, add)

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2019 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -39,18 +39,18 @@ void Func(Field<ReturnType>& res, const UList<Type>& f) \
TEMPLATE \ TEMPLATE \
tmp<Field<ReturnType>> Func(const UList<Type>& f) \ tmp<Field<ReturnType>> Func(const UList<Type>& f) \
{ \ { \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f.size())); \ auto tres = tmp<Field<ReturnType>>::New(f.size()); \
Func(tRes.ref(), f); \ Func(tres.ref(), f); \
return tRes; \ return tres; \
} \ } \
\ \
TEMPLATE \ TEMPLATE \
tmp<Field<ReturnType>> Func(const tmp<Field<Type>>& tf) \ tmp<Field<ReturnType>> Func(const tmp<Field<Type>>& tf) \
{ \ { \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type>::New(tf); \ auto tres = reuseTmp<ReturnType, Type>::New(tf); \
Func(tRes.ref(), tf()); \ Func(tres.ref(), tf()); \
tf.clear(); \ tf.clear(); \
return tRes; \ return tres; \
} }
@ -67,18 +67,18 @@ void OpFunc(Field<ReturnType>& res, const UList<Type>& f) \
TEMPLATE \ TEMPLATE \
tmp<Field<ReturnType>> operator Op(const UList<Type>& f) \ tmp<Field<ReturnType>> operator Op(const UList<Type>& f) \
{ \ { \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f.size())); \ auto tres = tmp<Field<ReturnType>>::New(f.size()); \
OpFunc(tRes.ref(), f); \ OpFunc(tres.ref(), f); \
return tRes; \ return tres; \
} \ } \
\ \
TEMPLATE \ TEMPLATE \
tmp<Field<ReturnType>> operator Op(const tmp<Field<Type>>& tf) \ tmp<Field<ReturnType>> operator Op(const tmp<Field<Type>>& tf) \
{ \ { \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type>::New(tf); \ auto tres = reuseTmp<ReturnType, Type>::New(tf); \
OpFunc(tRes.ref(), tf()); \ OpFunc(tres.ref(), tf()); \
tf.clear(); \ tf.clear(); \
return tRes; \ return tres; \
} }
@ -107,9 +107,9 @@ tmp<Field<ReturnType>> Func \
const UList<Type2>& f2 \ const UList<Type2>& f2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f1.size())); \ auto tres = tmp<Field<ReturnType>>::New(f1.size()); \
Func(tRes.ref(), f1, f2); \ Func(tres.ref(), f1, f2); \
return tRes; \ return tres; \
} \ } \
\ \
TEMPLATE \ TEMPLATE \
@ -119,10 +119,10 @@ tmp<Field<ReturnType>> Func \
const tmp<Field<Type2>>& tf2 \ const tmp<Field<Type2>>& tf2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type2>::New(tf2); \ auto tres = reuseTmp<ReturnType, Type2>::New(tf2); \
Func(tRes.ref(), f1, tf2()); \ Func(tres.ref(), f1, tf2()); \
tf2.clear(); \ tf2.clear(); \
return tRes; \ return tres; \
} \ } \
\ \
TEMPLATE \ TEMPLATE \
@ -132,10 +132,10 @@ tmp<Field<ReturnType>> Func \
const UList<Type2>& f2 \ const UList<Type2>& f2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type1>::New(tf1); \ auto tres = reuseTmp<ReturnType, Type1>::New(tf1); \
Func(tRes.ref(), tf1(), f2); \ Func(tres.ref(), tf1(), f2); \
tf1.clear(); \ tf1.clear(); \
return tRes; \ return tres; \
} \ } \
\ \
TEMPLATE \ TEMPLATE \
@ -145,12 +145,11 @@ tmp<Field<ReturnType>> Func \
const tmp<Field<Type2>>& tf2 \ const tmp<Field<Type2>>& tf2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes = \ auto tres = reuseTmpTmp<ReturnType, Type1, Type1, Type2>::New(tf1, tf2); \
reuseTmpTmp<ReturnType, Type1, Type1, Type2>::New(tf1, tf2); \ Func(tres.ref(), tf1(), tf2()); \
Func(tRes.ref(), tf1(), tf2()); \
tf1.clear(); \ tf1.clear(); \
tf2.clear(); \ tf2.clear(); \
return tRes; \ return tres; \
} }
@ -179,9 +178,9 @@ tmp<Field<ReturnType>> Func \
const UList<Type2>& f2 \ const UList<Type2>& f2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f2.size())); \ auto tres = tmp<Field<ReturnType>>::New(f2.size()); \
Func(tRes.ref(), s1, f2); \ Func(tres.ref(), s1, f2); \
return tRes; \ return tres; \
} \ } \
\ \
TEMPLATE \ TEMPLATE \
@ -191,10 +190,10 @@ tmp<Field<ReturnType>> Func \
const tmp<Field<Type2>>& tf2 \ const tmp<Field<Type2>>& tf2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type2>::New(tf2); \ auto tres = reuseTmp<ReturnType, Type2>::New(tf2); \
Func(tRes.ref(), s1, tf2()); \ Func(tres.ref(), s1, tf2()); \
tf2.clear(); \ tf2.clear(); \
return tRes; \ return tres; \
} }
@ -221,9 +220,9 @@ tmp<Field<ReturnType>> Func \
const Type2& s2 \ const Type2& s2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f1.size())); \ auto tres = tmp<Field<ReturnType>>::New(f1.size()); \
Func(tRes.ref(), f1, s2); \ Func(tres.ref(), f1, s2); \
return tRes; \ return tres; \
} \ } \
\ \
TEMPLATE \ TEMPLATE \
@ -233,10 +232,10 @@ tmp<Field<ReturnType>> Func \
const Type2& s2 \ const Type2& s2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type1>::New(tf1); \ auto tres = reuseTmp<ReturnType, Type1>::New(tf1); \
Func(tRes.ref(), tf1(), s2); \ Func(tres.ref(), tf1(), s2); \
tf1.clear(); \ tf1.clear(); \
return tRes; \ return tres; \
} }
@ -267,9 +266,9 @@ tmp<Field<ReturnType>> operator Op \
const UList<Type2>& f2 \ const UList<Type2>& f2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f1.size())); \ auto tres = tmp<Field<ReturnType>>::New(f1.size()); \
OpFunc(tRes.ref(), f1, f2); \ OpFunc(tres.ref(), f1, f2); \
return tRes; \ return tres; \
} \ } \
\ \
TEMPLATE \ TEMPLATE \
@ -279,10 +278,10 @@ tmp<Field<ReturnType>> operator Op \
const tmp<Field<Type2>>& tf2 \ const tmp<Field<Type2>>& tf2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type2>::New(tf2); \ auto tres = reuseTmp<ReturnType, Type2>::New(tf2); \
OpFunc(tRes.ref(), f1, tf2()); \ OpFunc(tres.ref(), f1, tf2()); \
tf2.clear(); \ tf2.clear(); \
return tRes; \ return tres; \
} \ } \
\ \
TEMPLATE \ TEMPLATE \
@ -292,10 +291,10 @@ tmp<Field<ReturnType>> operator Op \
const UList<Type2>& f2 \ const UList<Type2>& f2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type1>::New(tf1); \ auto tres = reuseTmp<ReturnType, Type1>::New(tf1); \
OpFunc(tRes.ref(), tf1(), f2); \ OpFunc(tres.ref(), tf1(), f2); \
tf1.clear(); \ tf1.clear(); \
return tRes; \ return tres; \
} \ } \
\ \
TEMPLATE \ TEMPLATE \
@ -305,12 +304,11 @@ tmp<Field<ReturnType>> operator Op \
const tmp<Field<Type2>>& tf2 \ const tmp<Field<Type2>>& tf2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes = \ auto tres = reuseTmpTmp<ReturnType, Type1, Type1, Type2>::New(tf1, tf2); \
reuseTmpTmp<ReturnType, Type1, Type1, Type2>::New(tf1, tf2); \ OpFunc(tres.ref(), tf1(), tf2()); \
OpFunc(tRes.ref(), tf1(), tf2()); \
tf1.clear(); \ tf1.clear(); \
tf2.clear(); \ tf2.clear(); \
return tRes; \ return tres; \
} }
@ -336,9 +334,9 @@ tmp<Field<ReturnType>> operator Op \
const UList<Type2>& f2 \ const UList<Type2>& f2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f2.size())); \ auto tres = tmp<Field<ReturnType>>::New(f2.size()); \
OpFunc(tRes.ref(), s1, f2); \ OpFunc(tres.ref(), s1, f2); \
return tRes; \ return tres; \
} \ } \
\ \
TEMPLATE \ TEMPLATE \
@ -348,10 +346,10 @@ tmp<Field<ReturnType>> operator Op \
const tmp<Field<Type2>>& tf2 \ const tmp<Field<Type2>>& tf2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type2>::New(tf2); \ auto tres = reuseTmp<ReturnType, Type2>::New(tf2); \
OpFunc(tRes.ref(), s1, tf2()); \ OpFunc(tres.ref(), s1, tf2()); \
tf2.clear(); \ tf2.clear(); \
return tRes; \ return tres; \
} }
@ -375,9 +373,9 @@ tmp<Field<ReturnType>> operator Op \
const Type2& s2 \ const Type2& s2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f1.size())); \ auto tres = tmp<Field<ReturnType>>::New(f1.size()); \
OpFunc(tRes.ref(), f1, s2); \ OpFunc(tres.ref(), f1, s2); \
return tRes; \ return tres; \
} \ } \
\ \
TEMPLATE \ TEMPLATE \
@ -387,10 +385,10 @@ tmp<Field<ReturnType>> operator Op \
const Type2& s2 \ const Type2& s2 \
) \ ) \
{ \ { \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type1>::New(tf1); \ auto tres = reuseTmp<ReturnType, Type1>::New(tf1); \
OpFunc(tRes.ref(), tf1(), s2); \ OpFunc(tres.ref(), tf1(), s2); \
tf1.clear(); \ tf1.clear(); \
return tRes; \ return tres; \
} }