diff --git a/P0959.md b/P0959.md index f99f750..4274309 100644 --- a/P0959.md +++ b/P0959.md @@ -28,7 +28,9 @@ Revised with feedback from the LWG and the community. * Removed typedefs and others container-like parts. * Defined the correlation between the internal UUID bytes and the string representation. * Added UUID layout and byte order specification from the RFC 4122 document. -# Most functions are constexpr. +* Most functions are constexpr. +* Replaced typedefs with using statements. + ## II. Motivation @@ -467,7 +469,7 @@ namespace std { class basic_uuid_random_generator { public: - typedef uuid result_type; + using result_type = uuid; basic_uuid_random_generator(); explicit basic_uuid_random_generator(UniformRandomNumberGenerator& gen); @@ -489,7 +491,7 @@ namespace std { class uuid_name_generator { public: - typedef uuid result_type; + using result_type = uuid; explicit uuid_name_generator(uuid const& namespace_uuid) noexcept; @@ -506,8 +508,8 @@ namespace std { template <> struct hash { - typedef uuid argument_type; - typedef std::size_t result_type; + using argument_type = uuid; + using result_type = std::size_t; result_type operator()(argument_type const &uuid) const; }; diff --git a/include/uuid.h b/include/uuid.h index f2e2c50..10d63e4 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -55,8 +55,8 @@ namespace uuids class sha1 { public: - typedef uint32_t digest32_t[5]; - typedef uint8_t digest8_t[20]; + using digest32_t = uint32_t[5]; + using digest8_t = uint8_t[20]; static constexpr unsigned int block_bytes = 64; @@ -297,12 +297,12 @@ namespace uuids { struct uuid_const_iterator { - typedef uuid_const_iterator self_type; - typedef uint8_t value_type; - typedef uint8_t const & reference; - typedef uint8_t const * pointer; - typedef std::random_access_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; + using self_type = uuid_const_iterator; + using value_type = uint8_t; + using reference = uint8_t const &; + using pointer = uint8_t const *; + using iterator_category = std::random_access_iterator_tag; + using difference_type = ptrdiff_t; protected: pointer ptr = nullptr; @@ -648,7 +648,7 @@ namespace uuids class uuid_system_generator { public: - typedef uuid result_type; + using result_type = uuid; uuid operator()() { @@ -744,7 +744,7 @@ namespace uuids class basic_uuid_random_generator { public: - typedef uuid result_type; + using result_type = uuid; basic_uuid_random_generator() :generator(new UniformRandomNumberGenerator) @@ -785,7 +785,7 @@ namespace uuids class uuid_name_generator { public: - typedef uuid result_type; + using result_type = uuid; explicit uuid_name_generator(uuid const& namespace_uuid) noexcept : nsuuid(namespace_uuid) @@ -860,8 +860,8 @@ namespace std template <> struct hash { - typedef uuids::uuid argument_type; - typedef std::size_t result_type; + using argument_type = uuids::uuid; + using result_type = std::size_t; result_type operator()(argument_type const &uuid) const {