From 1166c74127e7d3c356290b673ff8972d25df628b Mon Sep 17 00:00:00 2001 From: g3bk47 Date: Fri, 14 Sep 2018 03:22:06 +0200 Subject: [PATCH] add std:: to "inner_product" and "accumulate" This only works because the "dot" function is always called with std::vector::iterator as input so that "argument dependent lookup" introduces the std namespace to the function. If the dot function is called like this "dot(v.data(), v.data()+v.size(), v.data())", where "v" is a std::vector and the input are plain pointers, the compiler will not find "inner_product". The same is true for the use of "accumulate". --- include/cantera/base/utilities.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/cantera/base/utilities.h b/include/cantera/base/utilities.h index 8c3d6da24..a7486e540 100644 --- a/include/cantera/base/utilities.h +++ b/include/cantera/base/utilities.h @@ -107,7 +107,7 @@ template inline doublereal dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin) { - return inner_product(x_begin, x_end, y_begin, 0.0); + return std::inner_product(x_begin, x_end, y_begin, 0.0); } //! Multiply elements of an array by a scale factor. @@ -234,7 +234,7 @@ template inline void normalize(InputIter begin, InputIter end, OutputIter out) { - doublereal sum = accumulate(begin, end, 0.0); + doublereal sum = std::accumulate(begin, end, 0.0); for (; begin != end; ++begin, ++out) { *out = *begin/sum; }