From 987d9bd42b5480082968332b3228623c9afcf988 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Sun, 26 Oct 2025 12:53:22 +0100 Subject: [PATCH] [lib] Remove superfluous `typename` in alias declarations Also add an automatic check. Fixes NB US 64-127 (C++26 CD). --- source/containers.tex | 133 +++++++++++++++++++++--------------------- source/exec.tex | 4 +- source/future.tex | 4 +- source/iostreams.tex | 120 ++++++++++++++++++------------------- source/iterators.tex | 24 ++++---- source/memory.tex | 26 ++++----- source/meta.tex | 56 +++++++++--------- source/numerics.tex | 26 ++++----- source/ranges.tex | 6 +- source/strings.tex | 8 +-- source/support.tex | 6 +- source/text.tex | 12 ++-- source/time.tex | 6 +- source/utilities.tex | 4 +- tools/check-source.sh | 8 ++- 15 files changed, 223 insertions(+), 220 deletions(-) diff --git a/source/containers.tex b/source/containers.tex index 0557a7bd6a..d6722cfa38 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -6058,7 +6058,7 @@ \begin{codeblock} template - using @\placeholdernc{iter-value-type}@ = typename iterator_traits::value_type; // \expos + using @\placeholdernc{iter-value-type}@ = iterator_traits::value_type; // \expos \end{codeblock} \rSec2[array.syn]{Header \tcode{} synopsis} @@ -6504,8 +6504,8 @@ // types using value_type = T; using allocator_type = Allocator; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using size_type = @\impdefx{type of \tcode{deque::size_type}}@; // see \ref{container.requirements} @@ -7012,8 +7012,8 @@ // types using value_type = T; using allocator_type = Allocator; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using size_type = @\impdefx{type of \tcode{forward_list::size_type}}@; // see \ref{container.requirements} @@ -8007,8 +8007,8 @@ // types using value_type = T; using allocator_type = Allocator; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using size_type = @\impdef@; // see \ref{container.requirements} @@ -9067,8 +9067,8 @@ // types using value_type = T; using allocator_type = Allocator; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using size_type = @\impdefx{type of \tcode{list::size_type}}@; // see \ref{container.requirements} @@ -9867,8 +9867,8 @@ // types using value_type = T; using allocator_type = Allocator; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using size_type = @\impdefx{type of \tcode{vector::size_type}}@; // see \ref{container.requirements} @@ -11381,8 +11381,7 @@ The following exposition-only alias templates may appear in deduction guides for associative containers: \begin{codeblock} template - using @\placeholder{iter-value-type}@ = - typename iterator_traits::value_type; // \expos + using @\placeholder{iter-value-type}@ = iterator_traits::value_type; // \expos template using @\placeholder{iter-key-type}@ = remove_const_t< tuple_element_t<0, @\exposid{iter-value-type}@>>; // \expos @@ -11397,7 +11396,7 @@ using @\exposid{range-key-type}@ = remove_const_t::first_type>; // \expos template - using @\exposid{range-mapped-type}@ = typename ranges::range_value_t::second_type; // \expos + using @\exposid{range-mapped-type}@ = ranges::range_value_t::second_type; // \expos template using @\exposid{range-to-alloc-type}@ = pair::first_type>, @@ -11532,8 +11531,8 @@ using value_type = pair; using key_compare = Compare; using allocator_type = Allocator; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using size_type = @\impdefx{type of \tcode{map::size_type}}@; // see \ref{container.requirements} @@ -12275,8 +12274,8 @@ using value_type = pair; using key_compare = Compare; using allocator_type = Allocator; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using size_type = @\impdefx{type of \tcode{multimap::size_type}}@; // see \ref{container.requirements} @@ -12693,8 +12692,8 @@ using value_type = Key; using value_compare = Compare; using allocator_type = Allocator; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using size_type = @\impdefx{type of \tcode{set::size_type}}@; // see \ref{container.requirements} @@ -13059,8 +13058,8 @@ using value_type = Key; using value_compare = Compare; using allocator_type = Allocator; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using size_type = @\impdefx{type of \tcode{multiset::size_type}}@; // see \ref{container.requirements} @@ -13464,8 +13463,8 @@ using hasher = Hash; using key_equal = Pred; using allocator_type = Allocator; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using size_type = @\impdefx{type of \tcode{unordered_map::size_type}}@; // see \ref{container.requirements} @@ -14259,8 +14258,8 @@ using hasher = Hash; using key_equal = Pred; using allocator_type = Allocator; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using size_type = @\impdefx{type of \tcode{unordered_multimap::size_type}}@; // see \ref{container.requirements} @@ -14747,8 +14746,8 @@ using hasher = Hash; using key_equal = Pred; using allocator_type = Allocator; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using size_type = @\impdefx{type of \tcode{unordered_set::size_type}}@; // see \ref{container.requirements} @@ -15167,8 +15166,8 @@ using hasher = Hash; using key_equal = Pred; using allocator_type = Allocator; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using size_type = @\impdefx{type of \tcode{unordered_multiset::size_type}}@; // see \ref{container.requirements} @@ -15665,10 +15664,10 @@ template> class queue { public: - using value_type = typename Container::value_type; - using reference = typename Container::reference; - using const_reference = typename Container::const_reference; - using size_type = typename Container::size_type; + using value_type = Container::value_type; + using reference = Container::reference; + using const_reference = Container::const_reference; + using size_type = Container::size_type; using container_type = Container; protected: @@ -16028,10 +16027,10 @@ class Compare = less> class priority_queue { public: - using value_type = typename Container::value_type; - using reference = typename Container::reference; - using const_reference = typename Container::const_reference; - using size_type = typename Container::size_type; + using value_type = Container::value_type; + using reference = Container::reference; + using const_reference = Container::const_reference; + using size_type = Container::size_type; using container_type = Container; using value_compare = Compare; @@ -16578,10 +16577,10 @@ template> class stack { public: - using value_type = typename Container::value_type; - using reference = typename Container::reference; - using const_reference = typename Container::const_reference; - using size_type = typename Container::size_type; + using value_type = Container::value_type; + using reference = Container::reference; + using const_reference = Container::const_reference; + using size_type = Container::size_type; using container_type = Container; protected: @@ -18912,8 +18911,8 @@ using value_compare = Compare; using reference = value_type&; using const_reference = const value_type&; - using size_type = typename KeyContainer::size_type; - using difference_type = typename KeyContainer::difference_type; + using size_type = KeyContainer::size_type; + using difference_type = KeyContainer::difference_type; using iterator = @\impdefx{type of \tcode{flat_set::iterator}}@; // see \ref{container.requirements} using const_iterator = @\impdefx{type of \tcode{flat_set::const_iterator}}@; // see \ref{container.requirements} using reverse_iterator = std::reverse_iterator; @@ -19581,8 +19580,8 @@ using value_compare = Compare; using reference = value_type&; using const_reference = const value_type&; - using size_type = typename KeyContainer::size_type; - using difference_type = typename KeyContainer::difference_type; + using size_type = KeyContainer::size_type; + using difference_type = KeyContainer::difference_type; using iterator = @\impdefx{type of \tcode{flat_multiset::iterator}}@; // see \ref{container.requirements} using const_iterator = @\impdefx{type of \tcode{flat_multiset::const_iterator}}@; // see \ref{container.requirements} using reverse_iterator = std::reverse_iterator; @@ -21937,9 +21936,9 @@ class layout_left::mapping { public: using extents_type = Extents; - using index_type = typename extents_type::index_type; - using size_type = typename extents_type::size_type; - using rank_type = typename extents_type::rank_type; + using index_type = extents_type::index_type; + using size_type = extents_type::size_type; + using rank_type = extents_type::rank_type; using layout_type = layout_left; // \ref{mdspan.layout.left.cons}, constructors @@ -22259,9 +22258,9 @@ class layout_right::mapping { public: using extents_type = Extents; - using index_type = typename extents_type::index_type; - using size_type = typename extents_type::size_type; - using rank_type = typename extents_type::rank_type; + using index_type = extents_type::index_type; + using size_type = extents_type::size_type; + using rank_type = extents_type::rank_type; using layout_type = layout_right; // \ref{mdspan.layout.right.cons}, constructors @@ -22584,9 +22583,9 @@ class layout_stride::mapping { public: using extents_type = Extents; - using index_type = typename extents_type::index_type; - using size_type = typename extents_type::size_type; - using rank_type = typename extents_type::rank_type; + using index_type = extents_type::index_type; + using size_type = extents_type::size_type; + using rank_type = extents_type::rank_type; using layout_type = layout_stride; private: @@ -22972,9 +22971,9 @@ static constexpr size_t padding_value = PaddingValue; using extents_type = Extents; - using index_type = typename extents_type::index_type; - using size_type = typename extents_type::size_type; - using rank_type = typename extents_type::rank_type; + using index_type = extents_type::index_type; + using size_type = extents_type::size_type; + using rank_type = extents_type::rank_type; using layout_type = layout_left_padded; private: @@ -23595,9 +23594,9 @@ static constexpr size_t padding_value = PaddingValue; using extents_type = Extents; - using index_type = typename extents_type::index_type; - using size_type = typename extents_type::size_type; - using rank_type = typename extents_type::rank_type; + using index_type = extents_type::index_type; + using size_type = extents_type::size_type; + using rank_type = extents_type::rank_type; using layout_type = layout_right_padded; private: @@ -24652,14 +24651,14 @@ using extents_type = Extents; using layout_type = LayoutPolicy; using accessor_type = AccessorPolicy; - using mapping_type = typename layout_type::template mapping; + using mapping_type = layout_type::template mapping; using element_type = ElementType; using value_type = remove_cv_t; - using index_type = typename extents_type::index_type; - using size_type = typename extents_type::size_type; - using rank_type = typename extents_type::rank_type; - using data_handle_type = typename accessor_type::data_handle_type; - using reference = typename accessor_type::reference; + using index_type = extents_type::index_type; + using size_type = extents_type::size_type; + using rank_type = extents_type::rank_type; + using data_handle_type = accessor_type::data_handle_type; + using reference = accessor_type::reference; static constexpr rank_type rank() noexcept { return extents_type::rank(); } static constexpr rank_type rank_dynamic() noexcept { return extents_type::rank_dynamic(); } diff --git a/source/exec.tex b/source/exec.tex index e4cde049df..0f9ca7d9df 100644 --- a/source/exec.tex +++ b/source/exec.tex @@ -4777,7 +4777,7 @@ []( auto, State, Rcvr& rcvr, Tag, Args&&... args) noexcept -> void { if constexpr (@\libconcept{same_as}@) { - using variant_type = typename State::type; + using variant_type = State::type; @\exposid{TRY-SET-VALUE}@(rcvr, variant_type(@\exposid{decayed-tuple}@{std::forward(args)...})); } else { Tag()(std::move(rcvr), std::forward(args)...); @@ -5057,7 +5057,7 @@ template static consteval void @\exposid{check-types}@() { // \expos using associate_data_t = remove_cvref_t<@\exposid{data-type}@>; - using child_type_t = typename associate_data_t::@\exposid{wrap-sender}@; + using child_type_t = associate_data_t::@\exposid{wrap-sender}@; (void)get_completion_signatures(); } }; diff --git a/source/future.tex b/source/future.tex index 5022a94d67..bba0b7f73c 100644 --- a/source/future.tex +++ b/source/future.tex @@ -293,11 +293,11 @@ template // \seebelow struct aligned_storage; template // \seebelow - using @\libglobal{aligned_storage_t}@ = typename aligned_storage::type; + using @\libglobal{aligned_storage_t}@ = aligned_storage::type; template struct aligned_union; template - using @\libglobal{aligned_union_t}@ = typename aligned_union::type; + using @\libglobal{aligned_union_t}@ = aligned_union::type; } \end{codeblock} diff --git a/source/iostreams.tex b/source/iostreams.tex index 2de81f0e94..60f3c9fbf2 100644 --- a/source/iostreams.tex +++ b/source/iostreams.tex @@ -1814,9 +1814,9 @@ class basic_ios : public ios_base { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; // \ref{iostate.flags}, flags functions @@ -2999,9 +2999,9 @@ class basic_streambuf { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; virtual ~basic_streambuf(); @@ -4310,9 +4310,9 @@ public: // types (inherited from \tcode{basic_ios}\iref{ios}) using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; // \ref{istream.cons}, constructor/destructor @@ -5803,9 +5803,9 @@ public basic_ostream { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; // \ref{iostream.cons}, constructor @@ -5934,9 +5934,9 @@ public: // types (inherited from \tcode{basic_ios}\iref{ios}) using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; // \ref{ostream.cons}, constructor/destructor @@ -8038,9 +8038,9 @@ class basic_stringbuf : public basic_streambuf { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; using allocator_type = Allocator; @@ -8898,9 +8898,9 @@ class basic_istringstream : public basic_istream { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; using allocator_type = Allocator; @@ -9269,9 +9269,9 @@ class basic_ostringstream : public basic_ostream { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; using allocator_type = Allocator; @@ -9640,9 +9640,9 @@ class basic_stringstream : public basic_iostream { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; using allocator_type = Allocator; @@ -10091,9 +10091,9 @@ : public basic_streambuf { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; // \ref{spanbuf.cons}, constructors @@ -10418,9 +10418,9 @@ : public basic_istream { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; // \ref{ispanstream.cons}, constructors @@ -10606,9 +10606,9 @@ : public basic_ostream { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; // \ref{ospanstream.cons}, constructors @@ -10745,9 +10745,9 @@ : public basic_iostream { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; // \ref{spanstream.cons}, constructors @@ -10989,9 +10989,9 @@ class basic_filebuf : public basic_streambuf { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; using native_handle_type = @\impdefx{type of \tcode{native_handle_type}}@; // see \ref{file.native} @@ -11788,11 +11788,11 @@ class basic_ifstream : public basic_istream { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; - using native_handle_type = typename basic_filebuf::native_handle_type; + using native_handle_type = basic_filebuf::native_handle_type; // \ref{ifstream.cons}, constructors basic_ifstream(); @@ -12047,11 +12047,11 @@ class basic_ofstream : public basic_ostream { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; - using native_handle_type = typename basic_filebuf::native_handle_type; + using native_handle_type = basic_filebuf::native_handle_type; // \ref{ofstream.cons}, constructors basic_ofstream(); @@ -12304,11 +12304,11 @@ class basic_fstream : public basic_iostream { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; - using native_handle_type = typename basic_filebuf::native_handle_type; + using native_handle_type = basic_filebuf::native_handle_type; // \ref{fstream.cons}, constructors basic_fstream(); @@ -12621,9 +12621,9 @@ class basic_syncbuf : public basic_streambuf { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; using allocator_type = Allocator; @@ -12934,9 +12934,9 @@ class basic_osyncstream : public basic_ostream { public: using char_type = charT; - using int_type = typename traits::int_type; - using pos_type = typename traits::pos_type; - using off_type = typename traits::off_type; + using int_type = traits::int_type; + using pos_type = traits::pos_type; + using off_type = traits::off_type; using traits_type = traits; using allocator_type = Allocator; diff --git a/source/iterators.tex b/source/iterators.tex index 6a21fdf1c3..750d2b07cb 100644 --- a/source/iterators.tex +++ b/source/iterators.tex @@ -771,7 +771,7 @@ template requires requires { typename T::difference_type; } struct incrementable_traits { - using difference_type = typename T::difference_type; + using difference_type = T::difference_type; }; template @@ -1016,11 +1016,11 @@ \tcode{iterator_traits} has the following publicly accessible members: \begin{codeblock} -using iterator_category = typename I::iterator_category; -using value_type = typename I::value_type; -using difference_type = typename I::difference_type; +using iterator_category = I::iterator_category; +using value_type = I::value_type; +using difference_type = I::difference_type; using pointer = @\seebelow@; -using reference = typename I::reference; +using reference = I::reference; \end{codeblock} If the \grammarterm{qualified-id} \tcode{I::pointer} is valid and denotes a type, then \tcode{iterator_traits::pointer} names that type; @@ -1034,8 +1034,8 @@ publicly accessible members: \begin{codeblock} using iterator_category = @\seebelow@; -using value_type = typename indirectly_readable_traits::value_type; -using difference_type = typename incrementable_traits::difference_type; +using value_type = indirectly_readable_traits::value_type; +using difference_type = incrementable_traits::difference_type; using pointer = @\seebelow@; using reference = @\seebelow@; \end{codeblock} @@ -3201,7 +3201,7 @@ using iterator_category = @\seebelow@; using value_type = iter_value_t; using difference_type = iter_difference_t; - using pointer = typename iterator_traits::pointer; + using pointer = iterator_traits::pointer; using reference = iter_reference_t; constexpr reverse_iterator(); @@ -5920,9 +5920,9 @@ using value_type = iter_value_t; // present only // if \tcode{I} models \libconcept{indirectly_readable} using difference_type = iter_difference_t; - using iterator_concept = typename I::iterator_concept; // present only + using iterator_concept = I::iterator_concept; // present only // if the \grammarterm{qualified-id} \tcode{I::iterator_concept} is valid and denotes a type - using iterator_category = typename I::iterator_category; // present only + using iterator_category = I::iterator_category; // present only // if the \grammarterm{qualified-id} \tcode{I::iterator_category} is valid and denotes a type constexpr counted_iterator() requires @\libconcept{default_initializable}@ = default; constexpr counted_iterator(I x, iter_difference_t n); @@ -6892,12 +6892,12 @@ public: using iterator_category = input_iterator_tag; using value_type = charT; - using difference_type = typename traits::off_type; + using difference_type = traits::off_type; using pointer = @\unspec@; using reference = charT; using char_type = charT; using traits_type = traits; - using int_type = typename traits::int_type; + using int_type = traits::int_type; using streambuf_type = basic_streambuf; using istream_type = basic_istream; diff --git a/source/memory.tex b/source/memory.tex index e4a250b195..4246581299 100644 --- a/source/memory.tex +++ b/source/memory.tex @@ -777,7 +777,7 @@ template requires requires { typename T::element_type; } struct @\exposid{ptr-traits-elem}@ -{ using type = typename T::element_type; }; +{ using type = T::element_type; }; template class SomePointer, class T, class... Args> requires (!requires { typename SomePointer::element_type; }) @@ -1657,7 +1657,7 @@ template struct allocator_traits { using allocator_type = Alloc; - using value_type = typename Alloc::value_type; + using value_type = Alloc::value_type; using pointer = @\seebelow@; using const_pointer = @\seebelow@; @@ -5980,8 +5980,8 @@ public: using value_type = T; using allocator_type = Allocator; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; // \ref{indirect.ctor}, constructors constexpr explicit indirect(); @@ -6838,8 +6838,8 @@ public: using value_type = T; using allocator_type = Allocator; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; // \ref{polymorphic.ctor}, constructors constexpr explicit polymorphic(); @@ -8650,13 +8650,13 @@ using outer_allocator_type = OuterAlloc; using inner_allocator_type = @\seebelow@; - using value_type = typename OuterTraits::value_type; - using size_type = typename OuterTraits::size_type; - using difference_type = typename OuterTraits::difference_type; - using pointer = typename OuterTraits::pointer; - using const_pointer = typename OuterTraits::const_pointer; - using void_pointer = typename OuterTraits::void_pointer; - using const_void_pointer = typename OuterTraits::const_void_pointer; + using value_type = OuterTraits::value_type; + using size_type = OuterTraits::size_type; + using difference_type = OuterTraits::difference_type; + using pointer = OuterTraits::pointer; + using const_pointer = OuterTraits::const_pointer; + using void_pointer = OuterTraits::void_pointer; + using const_void_pointer = OuterTraits::const_void_pointer; using propagate_on_container_copy_assignment = @\seebelow@; using propagate_on_container_move_assignment = @\seebelow@; diff --git a/source/meta.tex b/source/meta.tex index ff0fa02efd..932ce591c3 100644 --- a/source/meta.tex +++ b/source/meta.tex @@ -307,17 +307,17 @@ template struct add_cv; template - using @\libglobal{remove_const_t}@ = typename remove_const::type; + using @\libglobal{remove_const_t}@ = remove_const::type; template - using @\libglobal{remove_volatile_t}@ = typename remove_volatile::type; + using @\libglobal{remove_volatile_t}@ = remove_volatile::type; template - using @\libglobal{remove_cv_t}@ = typename remove_cv::type; + using @\libglobal{remove_cv_t}@ = remove_cv::type; template - using @\libglobal{add_const_t}@ = typename add_const::type; + using @\libglobal{add_const_t}@ = add_const::type; template - using @\libglobal{add_volatile_t}@ = typename add_volatile::type; + using @\libglobal{add_volatile_t}@ = add_volatile::type; template - using @\libglobal{add_cv_t}@ = typename add_cv::type; + using @\libglobal{add_cv_t}@ = add_cv::type; // \ref{meta.trans.ref}, reference modifications template struct remove_reference; @@ -325,38 +325,38 @@ template struct add_rvalue_reference; template - using @\libglobal{remove_reference_t}@ = typename remove_reference::type; + using @\libglobal{remove_reference_t}@ = remove_reference::type; template - using @\libglobal{add_lvalue_reference_t}@ = typename add_lvalue_reference::type; + using @\libglobal{add_lvalue_reference_t}@ = add_lvalue_reference::type; template - using @\libglobal{add_rvalue_reference_t}@ = typename add_rvalue_reference::type; + using @\libglobal{add_rvalue_reference_t}@ = add_rvalue_reference::type; // \ref{meta.trans.sign}, sign modifications template struct make_signed; template struct make_unsigned; template - using @\libglobal{make_signed_t}@ = typename make_signed::type; + using @\libglobal{make_signed_t}@ = make_signed::type; template - using @\libglobal{make_unsigned_t}@ = typename make_unsigned::type; + using @\libglobal{make_unsigned_t}@ = make_unsigned::type; // \ref{meta.trans.arr}, array modifications template struct remove_extent; template struct remove_all_extents; template - using @\libglobal{remove_extent_t}@ = typename remove_extent::type; + using @\libglobal{remove_extent_t}@ = remove_extent::type; template - using @\libglobal{remove_all_extents_t}@ = typename remove_all_extents::type; + using @\libglobal{remove_all_extents_t}@ = remove_all_extents::type; // \ref{meta.trans.ptr}, pointer modifications template struct remove_pointer; template struct add_pointer; template - using @\libglobal{remove_pointer_t}@ = typename remove_pointer::type; + using @\libglobal{remove_pointer_t}@ = remove_pointer::type; template - using @\libglobal{add_pointer_t}@ = typename add_pointer::type; + using @\libglobal{add_pointer_t}@ = add_pointer::type; // \ref{meta.trans.other}, other transformations template struct type_identity; @@ -375,29 +375,29 @@ template struct unwrap_ref_decay; template - using @\libglobal{type_identity_t}@ = typename type_identity::type; + using @\libglobal{type_identity_t}@ = type_identity::type; template - using @\libglobal{remove_cvref_t}@ = typename remove_cvref::type; + using @\libglobal{remove_cvref_t}@ = remove_cvref::type; template - using @\libglobal{decay_t}@ = typename decay::type; + using @\libglobal{decay_t}@ = decay::type; template - using @\libglobal{enable_if_t}@ = typename enable_if::type; + using @\libglobal{enable_if_t}@ = enable_if::type; template - using @\libglobal{conditional_t}@ = typename conditional::type; + using @\libglobal{conditional_t}@ = conditional::type; template - using @\libglobal{common_type_t}@ = typename common_type::type; + using @\libglobal{common_type_t}@ = common_type::type; template - using @\libglobal{common_reference_t}@ = typename common_reference::type; + using @\libglobal{common_reference_t}@ = common_reference::type; template - using @\libglobal{underlying_type_t}@ = typename underlying_type::type; + using @\libglobal{underlying_type_t}@ = underlying_type::type; template - using @\libglobal{invoke_result_t}@ = typename invoke_result::type; + using @\libglobal{invoke_result_t}@ = invoke_result::type; template - using @\libglobal{apply_result_t}@ = typename apply_result::type; + using @\libglobal{apply_result_t}@ = apply_result::type; template - using unwrap_reference_t = typename unwrap_reference::type; + using unwrap_reference_t = unwrap_reference::type; template - using unwrap_ref_decay_t = typename unwrap_ref_decay::type; + using unwrap_ref_decay_t = unwrap_ref_decay::type; template using @\libglobal{void_t}@ = void; @@ -841,7 +841,7 @@ struct constant_wrapper : cw-operators { static constexpr const auto & value = X.@\exposid{data}@; using type = constant_wrapper; - using value_type = typename decltype(X)::@\exposid{type}@; + using value_type = decltype(X)::@\exposid{type}@; template<@\exposconcept{constexpr-param}@ R> constexpr auto operator=(R) const noexcept diff --git a/source/numerics.tex b/source/numerics.tex index 13dd44af9f..05b57912cd 100644 --- a/source/numerics.tex +++ b/source/numerics.tex @@ -3479,7 +3479,7 @@ class discard_block_engine { public: // types - using result_type = typename Engine::result_type; + using result_type = Engine::result_type; // engine characteristics static constexpr size_t block_size = p; @@ -3732,7 +3732,7 @@ class shuffle_order_engine { public: // types - using result_type = typename Engine::result_type; + using result_type = Engine::result_type; // engine characteristics static constexpr size_t table_size = k; @@ -12068,9 +12068,9 @@ struct mapping { public: using extents_type = Extents; - using index_type = typename extents_type::index_type; - using size_type = typename extents_type::size_type; - using rank_type = typename extents_type::rank_type; + using index_type = extents_type::index_type; + using size_type = extents_type::size_type; + using rank_type = extents_type::rank_type; using layout_type = layout_blas_packed; // \ref{linalg.layout.packed.cons}, constructors @@ -12789,7 +12789,7 @@ using element_type = add_const_t()))>; using reference = remove_const_t; - using data_handle_type = typename NestedAccessor::data_handle_type; + using data_handle_type = NestedAccessor::data_handle_type; using offset_policy = conjugated_accessor; constexpr conjugated_accessor() = default; @@ -13016,9 +13016,9 @@ public: using extents_type = Extents; - using index_type = typename extents_type::index_type; - using size_type = typename extents_type::size_type; - using rank_type = typename extents_type::rank_type; + using index_type = extents_type::index_type; + using size_type = extents_type::size_type; + using rank_type = extents_type::rank_type; using layout_type = layout_transpose; constexpr explicit mapping(const @\exposid{nested-mapping-type}@&); @@ -16256,7 +16256,7 @@ @\exposconcept{simd-vec-type}@ && @\libconcept{integral}@; template - using @\exposidnc{simd-complex-value-type}@ = typename V::value_type::value_type; // \expos + using @\exposidnc{simd-complex-value-type}@ = V::value_type::value_type; // \expos template concept @\defexposconceptnc{simd-complex}@ = // \expos @@ -16512,9 +16512,9 @@ constexpr size_t @\libmember{alignment_v}{simd}@ = alignment::value; template struct rebind { using type = @\seebelow@; }; - template using @\libmember{rebind_t}{simd}@ = typename rebind::type; + template using @\libmember{rebind_t}{simd}@ = rebind::type; template<@\exposid{simd-size-type}@ N, class V> struct resize { using type = @\seebelow@; }; - template<@\exposid{simd-size-type}@ N, class V> using @\libmember{resize_t}{simd}@ = typename resize::type; + template<@\exposid{simd-size-type}@ N, class V> using @\libmember{resize_t}{simd}@ = resize::type; // \ref{simd.flags}, load and store flags template struct flags; @@ -17312,7 +17312,7 @@ constexpr @\exposidnc{simd-iterator}@(V& d, @\exposidnc{simd-size-type}@ off) noexcept; // \expos public: - using value_type = typename V::value_type; + using value_type = V::value_type; using iterator_category = input_iterator_tag; using iterator_concept = random_access_iterator_tag; using difference_type = @\exposid{simd-size-type}@; diff --git a/source/ranges.tex b/source/ranges.tex index 8e329fb5fb..1f4f807da7 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -8227,7 +8227,7 @@ bool @\exposid{incremented_}@ = false; // \expos public: - using iterator_concept = typename @\exposid{outer-iterator}@::iterator_concept; + using iterator_concept = @\exposid{outer-iterator}@::iterator_concept; using iterator_category = @\seebelownc@; // present only if \exposid{Base} // models \libconcept{forward_range} @@ -12151,7 +12151,7 @@ public: using iterator_category = @\seebelownc@; // not always present - using iterator_concept = typename @\exposid{ziperator}@::iterator_concept; + using iterator_concept = @\exposid{ziperator}@::iterator_concept; using value_type = remove_cvref_t&, range_reference_t<@\exposid{maybe-const}@>...>>; @@ -13395,7 +13395,7 @@ public: using iterator_category = @\seebelow@; - using iterator_concept = typename @\exposid{inner-iterator}@::iterator_concept; + using iterator_concept = @\exposid{inner-iterator}@::iterator_concept; using value_type = remove_cvref_t&, @\exposid{REPEAT}@(range_reference_t<@\exposid{Base}@>, N)...>>; diff --git a/source/strings.tex b/source/strings.tex index 5a93b51d1a..9e1e9481b8 100644 --- a/source/strings.tex +++ b/source/strings.tex @@ -2040,10 +2040,10 @@ using traits_type = traits; using value_type = charT; using allocator_type = Allocator; - using size_type = typename allocator_traits::size_type; - using difference_type = typename allocator_traits::difference_type; - using pointer = typename allocator_traits::pointer; - using const_pointer = typename allocator_traits::const_pointer; + using size_type = allocator_traits::size_type; + using difference_type = allocator_traits::difference_type; + using pointer = allocator_traits::pointer; + using const_pointer = allocator_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; diff --git a/source/support.tex b/source/support.tex index ad8cbc5470..b6f6be77af 100644 --- a/source/support.tex +++ b/source/support.tex @@ -4826,7 +4826,7 @@ using type = @\seebelow@; }; template - using common_comparison_category_t = typename common_comparison_category::type; + using common_comparison_category_t = common_comparison_category::type; // \ref{cmp.concept}, concept \libconcept{three_way_comparable} template @@ -4838,7 +4838,7 @@ template struct compare_three_way_result; template - using compare_three_way_result_t = typename compare_three_way_result::type; + using compare_three_way_result_t = compare_three_way_result::type; // \ref{comparisons.three.way}, class \tcode{compare_three_way} struct compare_three_way; @@ -5826,7 +5826,7 @@ accessible member: \begin{codeblock} -using promise_type = typename R::promise_type; +using promise_type = R::promise_type; \end{codeblock} Otherwise, \tcode{coroutine_traits} has no members. diff --git a/source/text.tex b/source/text.tex index dcc768c8e8..f612a795a9 100644 --- a/source/text.tex +++ b/source/text.tex @@ -1684,7 +1684,7 @@ template class ctype_byname : public ctype { public: - using mask = typename ctype::mask; + using mask = ctype::mask; explicit ctype_byname(const char*, size_t refs = 0); explicit ctype_byname(const string&, size_t refs = 0); @@ -7448,7 +7448,7 @@ class basic_format_parse_context { public: using char_type = charT; - using const_iterator = typename basic_string_view::const_iterator; + using const_iterator = basic_string_view::const_iterator; using iterator = const_iterator; private: @@ -8428,7 +8428,7 @@ class handle; private: - using char_type = typename Context::char_type; // \expos + using char_type = Context::char_type; // \expos variant::difference_type; - using size_type = typename allocator_traits::size_type; + using size_type = allocator_traits::size_type; using allocator_type = Allocator; using char_type = typename iterator_traits::value_type; diff --git a/source/time.tex b/source/time.tex index 2e3e9b5576..d82346f75a 100644 --- a/source/time.tex +++ b/source/time.tex @@ -1248,7 +1248,7 @@ class duration { public: using rep = Rep; - using period = typename Period::type; + using period = Period::type; private: rep rep_; // \expos @@ -2220,8 +2220,8 @@ public: using clock = Clock; using duration = Duration; - using rep = typename duration::rep; - using period = typename duration::period; + using rep = duration::rep; + using period = duration::period; private: duration d_; // \expos diff --git a/source/utilities.tex b/source/utilities.tex index b05a0c2157..90b97ad1d6 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -1588,7 +1588,7 @@ struct tuple_element>; template - using @\libglobal{tuple_element_t}@ = typename tuple_element::type; + using @\libglobal{tuple_element_t}@ = tuple_element::type; // \ref{tuple.elem}, element access template @@ -5567,7 +5567,7 @@ template struct variant_alternative; // \notdef template struct variant_alternative; template - using @\libglobal{variant_alternative_t}@ = typename variant_alternative::type; + using @\libglobal{variant_alternative_t}@ = variant_alternative::type; template struct variant_alternative>; diff --git a/tools/check-source.sh b/tools/check-source.sh index 0babcd2af8..ffd7c94d47 100755 --- a/tools/check-source.sh +++ b/tools/check-source.sh @@ -133,11 +133,15 @@ grep -ne 'template\s\+<' $texlib | # In library declarations, constexpr should not follow explicit grep -ne '\bexplicit\b.*\bconstexpr\b' $texlib | - fail 'explicit constexpr' || failed=1 + fail 'wrong order: explicit constexpr' || failed=1 # In library declarations, static should not follow constexpr grep -ne '\bconstexpr\b.*\sstatic\s' $texlib | - fail 'constexpr static' || failed=1 + fail 'wrong order: constexpr static' || failed=1 + +# In library declarations, type aliases should not use typename +grep -ne "using.*= typename" $texlib | + fail 'type alias with typename' || failed=1 # "Class" heading without namespace for f in $texlib; do