-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: wep21 <[email protected]>
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
diff --git a/include/autoware_utils/ros/uuid_helper.hpp b/include/autoware_utils/ros/uuid_helper.hpp | ||
index 8e27b4c..bbb817f 100644 | ||
--- a/include/autoware_utils/ros/uuid_helper.hpp | ||
+++ b/include/autoware_utils/ros/uuid_helper.hpp | ||
@@ -23,6 +23,10 @@ | ||
#include <random> | ||
#include <string> | ||
|
||
+#if defined(_MSC_VER) && (_MSC_VER < 1600) | ||
+typedef unsigned __int8 uint8_t; | ||
+#endif | ||
+ | ||
namespace autoware_utils | ||
{ | ||
inline unique_identifier_msgs::msg::UUID generate_uuid() | ||
@@ -30,7 +34,11 @@ inline unique_identifier_msgs::msg::UUID generate_uuid() | ||
// Generate random number | ||
unique_identifier_msgs::msg::UUID uuid; | ||
std::mt19937 gen(std::random_device{}()); | ||
+#if defined(_MSC_VER) | ||
+ std::independent_bits_engine<std::mt19937, 8, unsigned short> bit_eng(gen); | ||
+#else | ||
std::independent_bits_engine<std::mt19937, 8, uint8_t> bit_eng(gen); | ||
+#endif | ||
std::generate(uuid.uuid.begin(), uuid.uuid.end(), bit_eng); | ||
|
||
return uuid; |