Skip to content

[libc++][NFC] Replace typedefs with using aliases in <string> #126070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions libcxx/include/string
Original file line number Diff line number Diff line change
Expand Up @@ -767,18 +767,18 @@ private:
using __default_allocator_type _LIBCPP_NODEBUG = allocator<_CharT>;

public:
typedef basic_string __self;
typedef basic_string_view<_CharT, _Traits> __self_view;
typedef _Traits traits_type;
typedef _CharT value_type;
typedef _Allocator allocator_type;
typedef allocator_traits<allocator_type> __alloc_traits;
typedef typename __alloc_traits::size_type size_type;
typedef typename __alloc_traits::difference_type difference_type;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef typename __alloc_traits::pointer pointer;
typedef typename __alloc_traits::const_pointer const_pointer;
using __self _LIBCPP_NODEBUG = basic_string;
using __self_view _LIBCPP_NODEBUG = basic_string_view<_CharT, _Traits>;
using traits_type = _Traits;
using value_type = _CharT;
using allocator_type = _Allocator;
using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<allocator_type>;
using size_type = typename __alloc_traits::size_type;
using difference_type = typename __alloc_traits::difference_type;
using reference = value_type&;
using const_reference = const value_type&;
using pointer = typename __alloc_traits::pointer;
using const_pointer = typename __alloc_traits::const_pointer;

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

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