From 8037826367a7becab046df2a8be08a28806a625f Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Thu, 12 Nov 2015 17:19:45 -0800 Subject: Simplified more of the IndexList code. --- .../Eigen/CXX11/src/Tensor/TensorIndexList.h | 112 ++++++++++++--------- 1 file changed, 65 insertions(+), 47 deletions(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h b/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h index 69d21d3c1..472fad0da 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h @@ -363,98 +363,124 @@ static constexpr bool indices_statically_known_to_increase() { template -struct index_statically_eq { - constexpr bool operator() (DenseIndex, DenseIndex) const { +struct index_statically_eq_impl { + static constexpr bool run(DenseIndex, DenseIndex) { return false; } }; template -struct index_statically_eq > { - constexpr bool operator() (const DenseIndex i, const DenseIndex value) const { +struct index_statically_eq_impl > { + static constexpr bool run(const DenseIndex i, const DenseIndex value) { return IndexList().value_known_statically(i) & (IndexList().get(i) == value); } }; template -struct index_statically_eq > { - constexpr bool operator() (const DenseIndex i, const DenseIndex value) const { +struct index_statically_eq_impl > { +static constexpr bool run(const DenseIndex i, const DenseIndex value) { return IndexList().value_known_statically(i) & (IndexList().get(i) == value); } }; template -struct index_statically_ne { - constexpr bool operator() (DenseIndex, DenseIndex) const { - return false; +static constexpr bool index_statically_eq(DenseIndex i, DenseIndex value) { + return index_statically_eq_impl::run(i, value); +} + + +template +struct index_statically_ne_impl { + static constexpr bool run(DenseIndex, DenseIndex) { + return false; } }; template -struct index_statically_ne > { - constexpr bool operator() (const DenseIndex i, const DenseIndex value) const { +struct index_statically_ne_impl > { + static constexpr bool run(const DenseIndex i, const DenseIndex value) { return IndexList().value_known_statically(i) & (IndexList().get(i) != value); } }; template -struct index_statically_ne > { - constexpr bool operator() (const DenseIndex i, const DenseIndex value) const { +struct index_statically_ne_impl > { +static constexpr bool run(const DenseIndex i, const DenseIndex value) { return IndexList().value_known_statically(i) & (IndexList().get(i) != value); } }; +template +static constexpr bool index_statically_ne(DenseIndex i, DenseIndex value) { + return index_statically_ne_impl::run(i, value); +} + + template -struct index_statically_gt { - constexpr bool operator() (DenseIndex, DenseIndex) const { - return false; +struct index_statically_gt_impl { + static constexpr bool run(DenseIndex, DenseIndex) { + return false; } }; template -struct index_statically_gt > { - constexpr bool operator() (const DenseIndex i, const DenseIndex value) const { +struct index_statically_gt_impl > { + static constexpr bool run(const DenseIndex i, const DenseIndex value) { return IndexList().value_known_statically(i) & (IndexList().get(i) > value); } }; template -struct index_statically_gt > { - constexpr bool operator() (const DenseIndex i, const DenseIndex value) const { +struct index_statically_gt_impl > { +static constexpr bool run(const DenseIndex i, const DenseIndex value) { return IndexList().value_known_statically(i) & (IndexList().get(i) > value); } }; template -struct index_statically_lt { - constexpr bool operator() (DenseIndex, DenseIndex) const { - return false; +static constexpr bool index_statically_gt(DenseIndex i, DenseIndex value) { + return index_statically_gt_impl::run(i, value); +} + + + + +template +struct index_statically_lt_impl { + static constexpr bool run(DenseIndex, DenseIndex) { + return false; } }; template -struct index_statically_lt > { - constexpr bool operator() (const DenseIndex i, const DenseIndex value) const { +struct index_statically_lt_impl > { + static constexpr bool run(const DenseIndex i, const DenseIndex value) { return IndexList().value_known_statically(i) & (IndexList().get(i) < value); } }; template -struct index_statically_lt > { - constexpr bool operator() (const DenseIndex i, const DenseIndex value) const { +struct index_statically_lt_impl > { +static constexpr bool run(const DenseIndex i, const DenseIndex value) { return IndexList().value_known_statically(i) & (IndexList().get(i) < value); } }; +template +static constexpr bool index_statically_lt(DenseIndex i, DenseIndex value) { + return index_statically_lt_impl::run(i, value); +} + + } // end namespace internal } // end namespace Eigen @@ -484,32 +510,24 @@ static EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool indices_statically_known_to_in } template -struct index_statically_eq { - EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool operator() (DenseIndex, DenseIndex) const{ - return false; - } -}; +static EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool indices_statically_eq(DenseIndex, DenseIndex) { + return false; +} template -struct index_statically_ne { - EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool operator() (DenseIndex, DenseIndex) const{ - return false; - } -}; +static EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool indices_statically_ne(DenseIndex, DenseIndex) { + return false; +} template -struct index_statically_gt { - EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool operator() (DenseIndex, DenseIndex) const{ - return false; - } -}; +static EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool indices_statically_gt(DenseIndex, DenseIndex) { + return false; +} template -struct index_statically_lt { - EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool operator() (DenseIndex, DenseIndex) const{ - return false; - } -}; +static EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool indices_statically_lt(DenseIndex, DenseIndex) { + return false; +} } // end namespace internal } // end namespace Eigen -- cgit v1.2.3