Skip to content

Commit 1f70eea

Browse files
committed
[libc++][NFC] Replace typedefs with using aliases in <string>
1 parent 4562efc commit 1f70eea

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

libcxx/include/string

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -767,18 +767,18 @@ private:
767767
using __default_allocator_type _LIBCPP_NODEBUG = allocator<_CharT>;
768768

769769
public:
770-
typedef basic_string __self;
771-
typedef basic_string_view<_CharT, _Traits> __self_view;
772-
typedef _Traits traits_type;
773-
typedef _CharT value_type;
774-
typedef _Allocator allocator_type;
775-
typedef allocator_traits<allocator_type> __alloc_traits;
776-
typedef typename __alloc_traits::size_type size_type;
777-
typedef typename __alloc_traits::difference_type difference_type;
778-
typedef value_type& reference;
779-
typedef const value_type& const_reference;
780-
typedef typename __alloc_traits::pointer pointer;
781-
typedef typename __alloc_traits::const_pointer const_pointer;
770+
using __self _LIBCPP_NODEBUG = basic_string;
771+
using __self_view _LIBCPP_NODEBUG = basic_string_view<_CharT, _Traits>;
772+
using traits_type = _Traits;
773+
using value_type = _CharT;
774+
using allocator_type = _Allocator;
775+
using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<allocator_type>;
776+
using size_type = typename __alloc_traits::size_type;
777+
using difference_type = typename __alloc_traits::difference_type;
778+
using reference = value_type&;
779+
using const_reference = const value_type&;
780+
using pointer = typename __alloc_traits::pointer;
781+
using const_pointer = typename __alloc_traits::const_pointer;
782782

783783
// A basic_string contains the following members which may be trivially relocatable:
784784
// - pointer: is currently assumed to be trivially relocatable, but is still checked in case that changes
@@ -841,14 +841,14 @@ public:
841841
// Users might provide custom allocators, and prior to C++20 we have no existing way to detect whether the allocator's
842842
// pointer type is contiguous (though it has to be by the Standard). Using the wrapper type ensures the iterator is
843843
// considered contiguous.
844-
typedef __bounded_iter<__wrap_iter<pointer> > iterator;
845-
typedef __bounded_iter<__wrap_iter<const_pointer> > const_iterator;
844+
using iterator = __bounded_iter<__wrap_iter<pointer> >;
845+
using const_iterator = __bounded_iter<__wrap_iter<const_pointer> >;
846846
# else
847-
typedef __wrap_iter<pointer> iterator;
848-
typedef __wrap_iter<const_pointer> const_iterator;
847+
using iterator = __wrap_iter<pointer>;
848+
using const_iterator = __wrap_iter<const_pointer>;
849849
# endif
850-
typedef std::reverse_iterator<iterator> reverse_iterator;
851-
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
850+
using reverse_iterator = std::reverse_iterator<iterator>;
851+
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
852852

853853
private:
854854
static_assert(CHAR_BIT == 8, "This implementation assumes that one byte contains 8 bits");

0 commit comments

Comments
 (0)