From a6376855d773282ab680c36002b3037cb0a4a9b1 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Thu, 2 Apr 2015 23:31:20 +0200 Subject: empty element evaluates to 0, tdf#89387 tdf#42481 related Change-Id: Ie3c8663319fe5f9b7aad2e063743a372c0b317ce --- sc/source/core/tool/scmatrix.cxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index 905413c57e66..400c260fde99 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -2082,7 +2082,8 @@ public: if (maOp.useFunctionForEmpty()) { std::vector aVec(node.size); - MatrixIteratorWrapper, T, typename T::empty_value_type> aFunc(aVec.begin(), aVec.end(), maOp); + MatrixIteratorWrapper, T, typename T::number_value_type> + aFunc(aVec.begin(), aVec.end(), maOp); pos = mrMat.set(pos, aFunc.begin(), aFunc.end()); } } @@ -2543,7 +2544,7 @@ struct COp {}; template struct COp { - svl::SharedString operator()(char, T /*aOp*/, const svl::SharedString& rString) const + svl::SharedString operator()(char, T /*aOp*/, double /*a*/, double /*b*/, const svl::SharedString& rString) const { return rString; } @@ -2552,14 +2553,17 @@ struct COp template struct COp { - double operator()(char, T aOp, const svl::SharedString& /*rString*/) const + double operator()(char, T aOp, double a, double b, const svl::SharedString& /*rString*/) const { - return aOp(double{}, double{}); + return aOp( a, b); } }; /** A template for operations where operands are supposed to be numeric. - A non-numeric operand leads to an errNoValue DoubleError. + A non-numeric (string) operand leads to an errNoValue DoubleError. + An empty operand evaluates to 0. + XXX: semantically TEmptyRes and types other than number_value_type are + unused, but this template could serve as a basis for future enhancements. */ template struct MatOp @@ -2598,7 +2602,7 @@ public: TEmptyRes operator()(char) const { - return maCOp(char{}, maOp, maString); + return maCOp(char{}, maOp, 0, mfVal, maString); } bool useFunctionForEmpty() const -- cgit