Drake
cond.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <functional>
4 #include <type_traits>
5 
7 
8 namespace drake {
32 template <typename ScalarType>
34 ScalarType cond(const ScalarType& e) {
35  return e;
36 }
37 template <typename ScalarType, typename... Rest>
38 ScalarType cond(const decltype(ScalarType() < ScalarType()) & f_cond,
39  const ScalarType& e_then, Rest... rest) {
40  return if_then_else(f_cond, e_then, cond(rest...));
41 }
43 } // namespace drake
Definition: automotive_demo.cc:88
Eigen::AutoDiffScalar< typename Eigen::internal::remove_all< DerType1 >::type::PlainObject > if_then_else(bool f_cond, const Eigen::AutoDiffScalar< DerType1 > &x, const Eigen::AutoDiffScalar< DerType2 > &y)
Provides if-then-else expression for Eigen::AutoDiffScalar type.
Definition: autodiff_overloads.h:157
Provides necessary operations on double to have it as a ScalarType in drake.
Eigen::AutoDiffScalar< typename Eigen::internal::remove_all< DerType >::type::PlainObject > cond(bool f_cond, const Eigen::AutoDiffScalar< DerType > &e_then, Rest...rest)
Provides special case of cond expression for Eigen::AutoDiffScalar type.
Definition: autodiff_overloads.h:174