Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • Kea Kea
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 559
    • Issues 559
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 58
    • Merge requests 58
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • ISC Open Source ProjectsISC Open Source Projects
  • KeaKea
  • Merge requests
  • !1857

Resolve "Wdeprecated-declarations warnings on std::iterator"

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Andrei Pavel requested to merge 2617-wdeprecated-declarations-warnings-on-std-iterator into master Nov 29, 2022
  • Overview 19
  • Commits 2
  • Pipelines 0
  • Changes 18

Closes #2617 (closed).

I took this article as inspiration and the code for std::string_view which looks like this under /usr/aarch64-linux-gnu/include/c++/12.2.0/string_view:

  template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
    class basic_string_view
    {
      static_assert(!is_array_v<_CharT>);
      static_assert(is_trivial_v<_CharT> && is_standard_layout_v<_CharT>);
      static_assert(is_same_v<_CharT, typename _Traits::char_type>);

    public:

      // types
      using traits_type		= _Traits;
      using value_type		= _CharT;
      using pointer		= value_type*;
      using const_pointer	= const value_type*;
      using reference		= value_type&;
      using const_reference	= const value_type&;
      using const_iterator	= const value_type*;
      using iterator		= const_iterator;
      using const_reverse_iterator = std::reverse_iterator<const_iterator>;
      using reverse_iterator	= const_reverse_iterator;
      using size_type		= size_t;
      using difference_type	= ptrdiff_t;
      static constexpr size_type npos = size_type(-1);

I thought about writing more unit tests to test for the iterator behavior, but I think the current tests should be enough.

Edited Dec 02, 2022 by Andrei Pavel
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: 2617-wdeprecated-declarations-warnings-on-std-iterator