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
This commit is contained in:
parent
2c6d95946e
commit
d00a441195
1 changed files with 0 additions and 33 deletions
|
@ -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::nanoseconds>(
|
||||
std::chrono::duration<long double>(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::nanoseconds>(
|
||||
std::chrono::duration<long double, std::milli>(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::nanoseconds>(
|
||||
std::chrono::duration<long double, std::nano>(ns));
|
||||
}
|
||||
|
||||
namespace rclcpp
|
||||
{
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue