From b2d9283b3c97ca364f384430e24c251710bde619 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 4 Oct 2019 00:28:13 -0400 Subject: [PATCH] rstl: Provide full set of type aliases in reserved_vector Allows for better integration with standard library facilities and templates, now that types can be queried. --- Runtime/rstl.hpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Runtime/rstl.hpp b/Runtime/rstl.hpp index d6a4bb136..1817ddc45 100644 --- a/Runtime/rstl.hpp +++ b/Runtime/rstl.hpp @@ -229,6 +229,26 @@ protected: */ template class reserved_vector : public _reserved_vector_base { + using base = _reserved_vector_base; + +public: + using value_type = T; + + using pointer = value_type*; + using const_pointer = const value_type*; + + using reference = value_type&; + using const_reference = const value_type&; + + using difference_type = std::ptrdiff_t; + using size_type = std::size_t; + + using iterator = typename base::iterator; + using const_iterator = typename base::const_iterator; + using reverse_iterator = typename base::reverse_iterator; + using const_reverse_iterator = typename base::const_reverse_iterator; + +private: union alignas(T) storage_t { struct { } _dummy; @@ -251,11 +271,6 @@ class reserved_vector : public _reserved_vector_base { } public: - using base = _reserved_vector_base; - using iterator = typename base::iterator; - using const_iterator = typename base::const_iterator; - using reverse_iterator = typename base::reverse_iterator; - using const_reverse_iterator = typename base::const_reverse_iterator; reserved_vector() : x0_size(0) {} template