diff --git a/include/uuid.h b/include/uuid.h index 07a46b8..63c54aa 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -352,6 +352,13 @@ namespace uuids name_based_sha1 = 5 // The name-based version specified in RFS 4122 with SHA1 hashing }; + // Forward declare uuid & to_string so that we can declare to_string as a friend later. + class uuid; + template , + class Allocator = std::allocator> + std::basic_string to_string(uuid const &id); + // -------------------------------------------------------------------------------------------------------------------------- // uuid class // -------------------------------------------------------------------------------------------------------------------------- @@ -550,9 +557,9 @@ namespace uuids return lhs.data < rhs.data; } - template, - class Allocator = std::allocator> + template inline std::basic_string to_string(uuid const & id) { std::basic_string uustr{detail::empty_guid}; @@ -920,7 +927,7 @@ namespace std static_cast(uuid.data[14]) << 8 | static_cast(uuid.data[15]); - if (sizeof(result_type) > 4) + if constexpr (sizeof(result_type) > 4) { return result_type(l ^ h); }