Skip to content

Commit 7788617

Browse files
authored
[libc++][NFC] Replace typedefs with using aliases in <string> (#126070)
1 parent b7279ed commit 7788617

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
@@ -764,18 +764,18 @@ struct __padding<0> {};
764764
template <class _CharT, class _Traits, class _Allocator>
765765
class basic_string {
766766
public:
767-
typedef basic_string __self;
768-
typedef basic_string_view<_CharT, _Traits> __self_view;
769-
typedef _Traits traits_type;
770-
typedef _CharT value_type;
771-
typedef _Allocator allocator_type;
772-
typedef allocator_traits<allocator_type> __alloc_traits;
773-
typedef typename __alloc_traits::size_type size_type;
774-
typedef typename __alloc_traits::difference_type difference_type;
775-
typedef value_type& reference;
776-
typedef const value_type& const_reference;
777-
typedef typename __alloc_traits::pointer pointer;
778-
typedef typename __alloc_traits::const_pointer const_pointer;
767+
using __self _LIBCPP_NODEBUG = basic_string;
768+
using __self_view _LIBCPP_NODEBUG = basic_string_view<_CharT, _Traits>;
769+
using traits_type = _Traits;
770+
using value_type = _CharT;
771+
using allocator_type = _Allocator;
772+
using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<allocator_type>;
773+
using size_type = typename __alloc_traits::size_type;
774+
using difference_type = typename __alloc_traits::difference_type;
775+
using reference = value_type&;
776+
using const_reference = const value_type&;
777+
using pointer = typename __alloc_traits::pointer;
778+
using const_pointer = typename __alloc_traits::const_pointer;
779779

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

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

0 commit comments

Comments
 (0)