aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Functors.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2011-05-31 22:17:34 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2011-05-31 22:17:34 +0200
commit35c1158ee376b31a740a538ac1251460102971dd (patch)
tree93109d172f2250e4b83667a7b33aa333994867cc /Eigen/src/Core/Functors.h
parentb495203310c53e80c240f349af06e359294e297a (diff)
add boolean || and && operators
Diffstat (limited to 'Eigen/src/Core/Functors.h')
-rw-r--r--Eigen/src/Core/Functors.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/Eigen/src/Core/Functors.h b/Eigen/src/Core/Functors.h
index e319c978e..9fcfc3e7b 100644
--- a/Eigen/src/Core/Functors.h
+++ b/Eigen/src/Core/Functors.h
@@ -220,6 +220,38 @@ struct functor_traits<scalar_quotient_op<Scalar> > {
};
};
+/** \internal
+ * \brief Template functor to compute the and of two booleans
+ *
+ * \sa class CwiseBinaryOp, ArrayBase::operator&&
+ */
+struct scalar_boolean_and_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_boolean_and_op)
+ EIGEN_STRONG_INLINE bool operator() (const bool& a, const bool& b) const { return a && b; }
+};
+template<> struct functor_traits<scalar_boolean_and_op> {
+ enum {
+ Cost = NumTraits<bool>::AddCost,
+ PacketAccess = false
+ };
+};
+
+/** \internal
+ * \brief Template functor to compute the or of two booleans
+ *
+ * \sa class CwiseBinaryOp, ArrayBase::operator||
+ */
+struct scalar_boolean_or_op {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_boolean_or_op)
+ EIGEN_STRONG_INLINE bool operator() (const bool& a, const bool& b) const { return a || b; }
+};
+template<> struct functor_traits<scalar_boolean_or_op> {
+ enum {
+ Cost = NumTraits<bool>::AddCost,
+ PacketAccess = false
+ };
+};
+
// unary functors:
/** \internal