From d00a441195e8de7d0f591a582b029ebc10eda532 Mon Sep 17 00:00:00 2001 From: Guillaume Papin Date: Sat, 17 Dec 2016 11:16:43 +0100 Subject: [PATCH] move user-defined literals in their own namespace (#284) * isolate chrono literals in literals.hpp * rclcpp.hpp: remove 'using namespace rclcpp::literals' The examples have been migrated to the new namespace. * literals: constexpr, make return types consistent with function body _ms returned nanoseconds instead of milliseconds. A few return types where using integral return type for floating point literals. * remove literals in favor of std::chrono_literals --- rclcpp/include/rclcpp/rclcpp.hpp | 33 -------------------------------- 1 file changed, 33 deletions(-) diff --git a/rclcpp/include/rclcpp/rclcpp.hpp b/rclcpp/include/rclcpp/rclcpp.hpp index 01c1c18..58892e3 100644 --- a/rclcpp/include/rclcpp/rclcpp.hpp +++ b/rclcpp/include/rclcpp/rclcpp.hpp @@ -27,39 +27,6 @@ #include "rclcpp/utilities.hpp" #include "rclcpp/visibility_control.hpp" -// NOLINTNEXTLINE(runtime/int) -inline const std::chrono::seconds operator"" _s(unsigned long long s) -{ - return std::chrono::seconds(s); -} -inline const std::chrono::nanoseconds operator"" _s(long double s) -{ - return std::chrono::duration_cast( - std::chrono::duration(s)); -} - -// NOLINTNEXTLINE(runtime/int) -inline const std::chrono::nanoseconds operator"" _ms(unsigned long long ms) -{ - return std::chrono::milliseconds(ms); -} -inline const std::chrono::nanoseconds operator"" _ms(long double ms) -{ - return std::chrono::duration_cast( - std::chrono::duration(ms)); -} - -// NOLINTNEXTLINE(runtime/int) -inline const std::chrono::nanoseconds operator"" _ns(unsigned long long ns) -{ - return std::chrono::nanoseconds(ns); -} -inline const std::chrono::nanoseconds operator"" _ns(long double ns) -{ - return std::chrono::duration_cast( - std::chrono::duration(ns)); -} - namespace rclcpp {