From 3a51fe31df9c486b766396b6b35fed1baa13bb66 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 6 Apr 2020 15:19:06 +0200 Subject: [PATCH] util/ConstBuffer, ...: use `using` instead of `typedef` --- src/util/ConstBuffer.hxx | 26 +++++++++++++------------- src/util/StringBuffer.hxx | 12 ++++++------ src/util/WritableBuffer.hxx | 26 +++++++++++++------------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/util/ConstBuffer.hxx b/src/util/ConstBuffer.hxx index 80fdf4dcc..c9608ba17 100644 --- a/src/util/ConstBuffer.hxx +++ b/src/util/ConstBuffer.hxx @@ -44,11 +44,11 @@ struct ConstBuffer; template<> struct ConstBuffer { typedef std::size_t size_type; - typedef void value_type; - typedef const void *pointer; - typedef pointer const_pointer; - typedef pointer iterator; - typedef pointer const_iterator; + using value_type = void; + using pointer = const void *; + using const_pointer = pointer; + using iterator = pointer; + using const_iterator = pointer; pointer data; size_type size; @@ -91,14 +91,14 @@ struct ConstBuffer { */ template struct ConstBuffer { - typedef std::size_t size_type; - typedef T value_type; - typedef const T &reference; - typedef reference const_reference; - typedef const T *pointer; - typedef pointer const_pointer; - typedef pointer iterator; - typedef pointer const_iterator; + using size_type = std::size_t; + using value_type = T; + using reference = const T &; + using const_reference = reference; + using pointer = const T *; + using const_pointer = pointer; + using iterator = pointer; + using const_iterator = pointer; pointer data; size_type size; diff --git a/src/util/StringBuffer.hxx b/src/util/StringBuffer.hxx index 07ce6dd31..817e31063 100644 --- a/src/util/StringBuffer.hxx +++ b/src/util/StringBuffer.hxx @@ -39,19 +39,19 @@ template class BasicStringBuffer { public: typedef T value_type; - typedef T &reference; - typedef T *pointer; - typedef const T *const_pointer; - typedef std::size_t size_type; + using reference = T &; + using pointer = T *; + using const_pointer = const T *; + using size_type = std::size_t; static constexpr value_type SENTINEL = '\0'; protected: - typedef std::array Array; + using Array = std::array; Array the_data; public: - typedef typename Array::const_iterator const_iterator; + using const_iterator = typename Array::const_iterator; constexpr size_type capacity() const noexcept { return CAPACITY; diff --git a/src/util/WritableBuffer.hxx b/src/util/WritableBuffer.hxx index 3fc8ed890..2ba32f22a 100644 --- a/src/util/WritableBuffer.hxx +++ b/src/util/WritableBuffer.hxx @@ -45,11 +45,11 @@ struct WritableBuffer; template<> struct WritableBuffer { typedef std::size_t size_type; - typedef void value_type; - typedef void *pointer; - typedef const void *const_pointer; - typedef pointer iterator; - typedef const_pointer const_iterator; + using value_type = void; + using pointer = void *; + using const_pointer = const void *; + using iterator = pointer; + using const_iterator = const_pointer; pointer data; size_type size; @@ -90,14 +90,14 @@ struct WritableBuffer { */ template struct WritableBuffer { - typedef std::size_t size_type; - typedef T value_type; - typedef T &reference; - typedef const T &const_reference; - typedef T *pointer; - typedef const T *const_pointer; - typedef pointer iterator; - typedef const_pointer const_iterator; + using size_type = std::size_t; + using value_type = T; + using reference = T &; + using const_reference = const T &; + using pointer = T *; + using const_pointer = const T *; + using iterator = pointer; + using const_iterator = const_pointer; pointer data; size_type size;