From 61a399e80a431b79a7a9818ae2665cb70eca1aef Mon Sep 17 00:00:00 2001 From: Jim Bosch Date: Wed, 9 Sep 2015 22:38:50 -0400 Subject: [PATCH] Remove const from rvalue returns (#42). I'd originally thought this was a useful way to prevent no-op assignments to rvalues, but compilers now check for that without using const, and it was probably only non-standard compiler behavior that ever made it useful. --- boost/numpy/ndarray.hpp | 8 ++++---- boost/numpy/ufunc.hpp | 4 ++-- libs/numpy/src/ndarray.cpp | 6 +++--- libs/numpy/src/ufunc.cpp | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/boost/numpy/ndarray.hpp b/boost/numpy/ndarray.hpp index 8c2a2627..a702df33 100644 --- a/boost/numpy/ndarray.hpp +++ b/boost/numpy/ndarray.hpp @@ -87,10 +87,10 @@ public: ndarray copy() const; /// @brief Return the size of the nth dimension. - Py_intptr_t const shape(int n) const { return get_shape()[n]; } + Py_intptr_t shape(int n) const { return get_shape()[n]; } /// @brief Return the stride of the nth dimension. - Py_intptr_t const strides(int n) const { return get_strides()[n]; } + Py_intptr_t strides(int n) const { return get_strides()[n]; } /** * @brief Return the array's raw data pointer. @@ -116,10 +116,10 @@ public: Py_intptr_t const * get_strides() const { return get_struct()->strides; } /// @brief Return the number of array dimensions. - int const get_nd() const { return get_struct()->nd; } + int get_nd() const { return get_struct()->nd; } /// @brief Return the array flags. - bitflag const get_flags() const; + bitflag get_flags() const; /// @brief Reverse the dimensions of the array. ndarray transpose() const; diff --git a/boost/numpy/ufunc.hpp b/boost/numpy/ufunc.hpp index 98ecbf49..d86fa34b 100644 --- a/boost/numpy/ufunc.hpp +++ b/boost/numpy/ufunc.hpp @@ -52,13 +52,13 @@ public: char * get_data(int n) const; /// @brief Return the number of dimensions of the broadcasted array expression. - int const get_nd() const; + int get_nd() const; /// @brief Return the shape of the broadcasted array expression as an array of integers. Py_intptr_t const * get_shape() const; /// @brief Return the shape of the broadcasted array expression in the nth dimension. - Py_intptr_t const shape(int n) const; + Py_intptr_t shape(int n) const; }; diff --git a/libs/numpy/src/ndarray.cpp b/libs/numpy/src/ndarray.cpp index ce431546..481692e3 100644 --- a/libs/numpy/src/ndarray.cpp +++ b/libs/numpy/src/ndarray.cpp @@ -22,7 +22,7 @@ namespace numpy namespace detail { -ndarray::bitflag numpy_to_bitflag(int const f) +ndarray::bitflag numpy_to_bitflag(int const f) { ndarray::bitflag r = ndarray::NONE; if (f & NPY_C_CONTIGUOUS) r = (r | ndarray::C_CONTIGUOUS); @@ -32,7 +32,7 @@ ndarray::bitflag numpy_to_bitflag(int const f) return r; } -int const bitflag_to_numpy(ndarray::bitflag f) +int bitflag_to_numpy(ndarray::bitflag f) { int r = 0; if (f & ndarray::C_CONTIGUOUS) r |= NPY_C_CONTIGUOUS; @@ -184,7 +184,7 @@ void ndarray::set_base(object const & base) } } -ndarray::bitflag const ndarray::get_flags() const +ndarray::bitflag ndarray::get_flags() const { return numpy::detail::numpy_to_bitflag(get_struct()->flags); } diff --git a/libs/numpy/src/ufunc.cpp b/libs/numpy/src/ufunc.cpp index aa6c7939..a6a728f9 100644 --- a/libs/numpy/src/ufunc.cpp +++ b/libs/numpy/src/ufunc.cpp @@ -50,7 +50,7 @@ char * multi_iter::get_data(int i) const return reinterpret_cast(PyArray_MultiIter_DATA(ptr(), i)); } -int const multi_iter::get_nd() const +int multi_iter::get_nd() const { return reinterpret_cast(ptr())->nd; } @@ -60,7 +60,7 @@ Py_intptr_t const * multi_iter::get_shape() const return reinterpret_cast(ptr())->dimensions; } -Py_intptr_t const multi_iter::shape(int n) const +Py_intptr_t multi_iter::shape(int n) const { return reinterpret_cast(ptr())->dimensions[n]; }