[macstl-dev] macstl wrapper
Ilya Lipovsky
lipovsky at skycomputers.com
Fri Jun 3 02:49:35 WST 2005
Simon,
I surmise you meant:
template<class T>
NumericArray2<T>
operator*( const NumericArray2<T>& op1, const
NumericArray2& op2 )
{
return NumericArray2<T>( op1.get_data() * op2.get_data() );
}
?
If so, make sure get_data returns thru constant reference. Also, operator*
of NumericArray2 has to return thru constant reference as well.
-Ilya
_____________________________________________________________________
Ilya Lipovsky
Engineer, Algorithms Group
SKY Computers(R), Inc., 8 Centennial Drive M/S A-14, Peabody MA 01960
On Thu, 2 Jun 2005, Simon P wrote:
> Hi,
>
> I have a wrapper for macstl valarray for 2D and 3D
> arrays:
>
> template<class T>
> class NumericArray2
> {
>
>
> private:
>
> stdext::valarray<float> _data;
>
> }
>
> I also define some operators that are just wrappers
> around valarray's operators:
>
> template<class T>
> NumericArray2<T>
> operator*( const NumericArray2<T>& op1, const
> NumericArray2& op2 )
> {
> return NumericArray2<T>( op1 * op2 );
> }
>
> When I run this code, raw macstl runs about 8 times
> faster than
> when I run it with NumericArray2. It seems that
> there's an extra copy that occurs with the wrapper
> that doesn't happen with macstl valarray.
>
> Any thoughts or ideas as to how to improve this such
> that there's no or little overhead?
>
> Thanks,
>
> Simon
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>
> _______________________________________________
> macstl-dev mailing list
> macstl-dev at pixelglow.com
> http://www.pixelglow.com/lists/listinfo/macstl-dev
>
More information about the macstl-dev
mailing list