Skip to content

Commit

Permalink
Merge pull request RobotLocomotion#5279 from jwnimmer-tri/common-ite-…
Browse files Browse the repository at this point in the history
…inline

Change if_then_else to be inline
  • Loading branch information
jwnimmer-tri authored Feb 23, 2017
2 parents 0c7a92b + 664e849 commit 62ad739
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 2 additions & 6 deletions drake/common/double_overloads.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#include "drake/common/double_overloads.h"

namespace drake {
double if_then_else(const bool f_cond, const double v_then,
const double v_else) {
return f_cond ? v_then : v_else;
}
} // namespace drake
// For now, this is an empty .cc file that only serves to confirm that
// double_overloads.h is a stand-alone header.
5 changes: 4 additions & 1 deletion drake/common/double_overloads.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@ namespace drake {
/// v_else are evaluated regardless of the evaluation of @p f_cond. In contrast,
/// only one of @p v_then or @p v_else is evaluated in C++'s conditional
/// expression <tt>f_cond ? v_then : v_else</tt>.
double if_then_else(bool f_cond, double v_then, double v_else);
inline double if_then_else(bool f_cond, double v_then, double v_else) {
return f_cond ? v_then : v_else;
}

} // namespace drake

0 comments on commit 62ad739

Please sign in to comment.