From 57f1af36aa31137e74819a3f9b1beefaf592f7e9 Mon Sep 17 00:00:00 2001 From: "matthias@arch" Date: Sat, 5 Nov 2022 20:45:20 +0100 Subject: [PATCH] overload for void*, fixed amib. for bool --- src/string/to_string.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/string/to_string.hpp b/src/string/to_string.hpp index cd8020e..fbf8d13 100644 --- a/src/string/to_string.hpp +++ b/src/string/to_string.hpp @@ -198,7 +198,7 @@ namespace gz { * @returns std::to_string(t) */ template - inline std::string toString(const T& t) { + inline std::string toString(const T& t) requires (!std::same_as) { return std::to_string(t); } @@ -302,6 +302,15 @@ namespace gz { inline std::string toString(const T& t) { return toString(*t); } + + /** + * @overload + * @brief Construct a string from the address of the void* + * @returns toString(reinterpret_cast(voidPtr)) + */ + inline std::string toString(const void* const voidPtr) { + return toString(reinterpret_cast(voidPtr)); + } } // namespace gz