Details

    Description

      QOffsetStringArray is a kind of container, and it's sometimes useful to iterate over it (esp. with std::lower_bound). The value_type if the iterator should be decltype(viewAt(0)).

      Acceptance criteria:

      1. The following tests pass:
        constexpr auto table = qOffsetStringArray("aha", "boo", "coocoo");
        static_assert(q20::is_sorted(table.begin(), table.end()));
        auto it = std::lower_bound(table.begin(), table.end(), table.viewAt(1));
        assert(it == table.begin() + 1);
        auto rit = std::lower_bound(table.rbegin(), table.rend(), QByteArrayView{"axe"}, std::greater<>{});
        assert(rit == table.rbegin() + 2);
        
      2. there is a QSortedOffsetStringArray that statically asserts that the elements are ordered and provides a member contains() with O(log N) complexity (ie. binary search, using std::lower_bound().
      3. the BannedHeaders array in qnetworkreplywasmimpl.cpp is ported to QSortedOffsetStringArray and its contains() method.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              cnn Qt Core & Network
              mmutz Marc Mutz
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes