From 621c86a2f43ff461a523639b07e1e383c52bac56 Mon Sep 17 00:00:00 2001 From: Tom de Geus Date: Sat, 5 May 2018 18:13:25 +0200 Subject: [PATCH] Minor bugfix: used reference to static const --- src/cppmat/cppmat.h | 2 +- src/cppmat/tensor2.cpp | 9 ++++++--- src/cppmat/tensor3.cpp | 9 ++++++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/cppmat/cppmat.h b/src/cppmat/cppmat.h index 8329293..64ad2e5 100644 --- a/src/cppmat/cppmat.h +++ b/src/cppmat/cppmat.h @@ -23,7 +23,7 @@ #define CPPMAT_WORLD_VERSION 0 #define CPPMAT_MAJOR_VERSION 6 -#define CPPMAT_MINOR_VERSION 3 +#define CPPMAT_MINOR_VERSION 4 #define CPPMAT_VERSION_AT_LEAST(x,y,z) \ (CPPMAT_WORLD_VERSION>x || (CPPMAT_WORLD_VERSION>=x && \ diff --git a/src/cppmat/tensor2.cpp b/src/cppmat/tensor2.cpp index 77a1b27..6b82426 100644 --- a/src/cppmat/tensor2.cpp +++ b/src/cppmat/tensor2.cpp @@ -806,7 +806,8 @@ inline std::vector tensor4::shape() const { std::vector out(4); - std::fill(out.begin(), out.end(), mNd); + for ( size_t i = 0 ; i < 4 ; ++i ) + out[i] = mNd; return out; } @@ -818,7 +819,8 @@ inline std::vector tensor2::shape() const { std::vector out(2); - std::fill(out.begin(), out.end(), mNd); + for ( size_t i = 0 ; i < 2 ; ++i ) + out[i] = mNd; return out; } @@ -830,7 +832,8 @@ inline std::vector vector::shape() const { std::vector out(1); - std::fill(out.begin(), out.end(), mNd); + for ( size_t i = 0 ; i < 1 ; ++i ) + out[i] = mNd; return out; } diff --git a/src/cppmat/tensor3.cpp b/src/cppmat/tensor3.cpp index cd64ac6..4e6b20a 100644 --- a/src/cppmat/tensor3.cpp +++ b/src/cppmat/tensor3.cpp @@ -821,7 +821,8 @@ inline std::vector tensor4::shape() const { std::vector out(4); - std::fill(out.begin(), out.end(), mNd); + for ( size_t i = 0 ; i < 4 ; ++i ) + out[i] = mNd; return out; } @@ -833,7 +834,8 @@ inline std::vector tensor2::shape() const { std::vector out(2); - std::fill(out.begin(), out.end(), mNd); + for ( size_t i = 0 ; i < 2 ; ++i ) + out[i] = mNd; return out; } @@ -845,7 +847,8 @@ inline std::vector vector::shape() const { std::vector out(1); - std::fill(out.begin(), out.end(), mNd); + for ( size_t i = 0 ; i < 1 ; ++i ) + out[i] = mNd; return out; }