Compare commits

...

1 Commits

Author SHA1 Message Date
Chris Lalancette
23ad2b4a4e Fix Windows min/max macro problem.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
2020-11-17 16:03:15 +00:00
2 changed files with 16 additions and 2 deletions

View File

@@ -21,6 +21,13 @@
#include "rcl/time.h"
#include "rclcpp/visibility_control.hpp"
// Windows has preprocessor defines for "min" and "max", which can cause
// problems when things like std::numeric_limits<int>::max are used. This
// macro is used to defeat the macro matching logic and hence workaround the
// issue. The idea comes from:
// https://stackoverflow.com/questions/11544073/how-do-i-deal-with-the-max-macro-in-windows-h-colliding-with-max-in-std/11550864#11550864
#define PREVENT_WINDOWS_MIN_MAX
namespace rclcpp
{
class RCLCPP_PUBLIC Duration
@@ -108,7 +115,7 @@ public:
*/
static
Duration
max();
max PREVENT_WINDOWS_MIN_MAX();
Duration
operator*(double scale) const;

View File

@@ -23,6 +23,13 @@
#include "rclcpp/duration.hpp"
// Windows has preprocessor defines for "min" and "max", which can cause
// problems when things like std::numeric_limits<int>::max are used. This
// macro is used to defeat the macro matching logic and hence workaround the
// issue. The idea comes from:
// https://stackoverflow.com/questions/11544073/how-do-i-deal-with-the-max-macro-in-windows-h-colliding-with-max-in-std/11550864#11550864
#define PREVENT_WINDOWS_MIN_MAX
namespace rclcpp
{
@@ -189,7 +196,7 @@ public:
*/
RCLCPP_PUBLIC
static Time
max();
max PREVENT_WINDOWS_MIN_MAX();
/// Get the seconds since epoch
/**