Commit Graph

906 Commits

Author SHA1 Message Date
Max Kellermann 393d57b387 util/NumberParser: rename to CNumberParser
A new NumberParser library based on std::from_chars() will be added.
2024-01-04 21:02:45 +01:00
Max Kellermann 23b4688c44 util/ByteOrder: move Packed* classes to separate headers 2023-12-22 18:20:46 +01:00
Max Kellermann ebf1fc7ca4 util/IntrusiveList: convert static_assert to concept check 2023-11-21 20:42:01 +01:00
Max Kellermann edfa329e64 util/DereferenceIterator: use *declval() to guess the default value type
This allows the iterator to point to another iterator.
2023-11-21 20:40:47 +01:00
Max Kellermann 68b19ae087 util/SpanCast: add ReferenceAsWritableBytes() 2023-11-02 10:50:24 +01:00
Max Kellermann a073db1e52 util/SpanCast: add ReferenceAsBytes() 2023-11-02 10:50:00 +01:00
Max Kellermann 10940da381 util/Intrusive{List,HashSet}: add "tag" for base hooks 2023-11-02 10:48:46 +01:00
Max Kellermann db5f270f42 util/AllocatedString: fix string_view specialization in TotalSize() 2023-10-09 14:54:40 +02:00
Max Kellermann 86e7dff2fc util/TextFile: add missing cast 2023-10-07 08:39:24 +02:00
Max Kellermann e5680c712b util/IntrusiveList: add reverse_iterator 2023-10-04 16:51:17 +02:00
Max Kellermann 44daa6d3e6 util/IntrusiveForwardList: reset last_cache properly in clear() 2023-10-04 16:50:46 +02:00
Max Kellermann 5aaa3f50aa util/BindMethod: move SignatureHelper to return type 2023-10-04 16:50:25 +02:00
Max Kellermann 7d26cd74c1 util/BindMethod: add noexcept 2023-10-04 16:50:25 +02:00
Max Kellermann 7e6941acc8 util/BindMethod: add constexpr 2023-10-04 16:50:25 +02:00
Max Kellermann 63d865666e util/StringBuffer: use using instead of typedef 2023-10-04 16:50:25 +02:00
Max Kellermann 5dda4084df util/BindMethod: use using instead of typedef 2023-10-04 16:50:25 +02:00
Max Kellermann 19f9238ef0 util/BindMethod: fix indent 2023-10-04 16:50:25 +02:00
Max Kellermann 5b28a987e5 util/IntrusiveForwardList: add method remove_and_dispose_if() 2023-09-22 11:32:40 +02:00
Max Kellermann 78d28063c4 util/IntrusiveForwardList: push_{front,back}() returns iterator 2023-09-22 11:32:33 +02:00
Max Kellermann 6f7dce6dca test/util/TestIntrusiveForwardList: implement size() only if options.constant_time_size is set 2023-09-16 22:39:03 +02:00
Max Kellermann 175524ad02 util/IntrusiveForwardList: make end() non-static
So we can have a `const` overload which is important for some
algorithm templates.
2023-09-16 22:39:03 +02:00
Max Kellermann bfbde72676 util/Intrusive*: insertion methods return an iterator 2023-09-16 22:39:03 +02:00
Max Kellermann f76583a08a util/IntrusiveList: document the erase() return value 2023-09-16 22:39:03 +02:00
Max Kellermann 6d39b401b5 util/IntrusiveForwardList: add method iterator_to() 2023-09-16 22:39:03 +02:00
Max Kellermann f448bfd3f3 util/IntrusiveForwardList: add option cache_last 2023-09-16 22:39:03 +02:00
Max Kellermann 64b0587e78 util/OptionalField: new library 2023-09-16 22:39:03 +02:00
Max Kellermann 9fe813e572 util/IntrusiveForwardList: add pop_front_and_dispose() 2023-09-16 22:39:03 +02:00
Max Kellermann b0da0bbf8b util/IntrusiveForwardList: pop_front() returns reference 2023-09-16 22:39:03 +02:00
Max Kellermann 5c44082b77 util/IntrusiveForwardList: add non-static insert_after() implementation 2023-09-16 22:39:03 +02:00
Max Kellermann df7ed27b78 util/IntrusiveForwardList: fix move operator, really swap counter 2023-09-16 22:39:03 +02:00
Max Kellermann 9e802ad721 util/StringCompare: add pure attribute 2023-09-12 09:34:52 +02:00
Max Kellermann daf935d310 util/HexFormat: add non-const overload 2023-09-12 09:11:38 +02:00
Max Kellermann f68305bf00 util/NumberParser: remove obsolete __ANDROID_API__ check 2023-09-11 22:12:13 +02:00
Max Kellermann a58275591d util/StaticVector: add methods erase(), pop_front() 2023-09-11 21:59:28 +02:00
Max Kellermann a2f4fb9ddb util/StaticVector: add method pop_back() 2023-09-11 21:59:21 +02:00
Max Kellermann b2acf02af9 util/StaticVector: push_back(), emplace_back() return reference
Imitating std::vector since C++17.
2023-09-11 21:59:12 +02:00
Max Kellermann d5b1ca1a52 util/StaticVector: use emplace_back() to implement push_back()
For this class, both are equal.
2023-09-11 21:58:56 +02:00
Max Kellermann 847ae7dd7c util/IntrusiveHashSet: add insert_check_if() 2023-09-11 21:15:28 +02:00
Max Kellermann 44f55e1866 util/IntrusiveList: add missing initializer to insert_after()
We must not call std::next() if the list head was not yet initialized.
This was missing in commit 7065425927
2023-09-11 21:15:28 +02:00
Max Kellermann c391adad10 tag/Pool: move code from calc_hash() to util/djb_hash.cxx 2023-09-11 20:53:37 +02:00
Max Kellermann 7dff29bcd1 util/IntrusiveHashSet: add option zero_initialized 2023-09-11 20:34:17 +02:00
Max Kellermann 7065425927 util/IntrusiveList: add option zero_initialized 2023-09-11 20:30:38 +02:00
Max Kellermann f01793ad4a util/Intrusive*: move constant_time_size to an options struct
This makes it easier to add more options later.
2023-09-11 19:18:36 +02:00
Max Kellermann b35e8a588f util/IntrusiveForwardList: add operator++(int) 2023-09-06 15:31:07 +02:00
Max Kellermann 1448f52eac util/VarSize: convert static_assert to concept check 2023-09-06 15:05:26 +02:00
Max Kellermann 80104eb6d5 util/IntrusiveList: fix illegal downcast (ubsan)
Fixes UBSanitizer warning:

 src/util/IntrusiveList.hxx:108:10: runtime error: downcast of address 0xdeadbeef which does not point to an object of type 'Foo'
2023-08-03 20:56:34 +02:00
Max Kellermann 83a6cb804b util/IntrusiveHashSet: add template argument GetKey
This is a big simplification of all IntrusiveHashSet users: instead of
having to implement multiple overloads of Hash and Equal, the
IntrusiveHashSet class can first extract the effective key from an
item and then pass it to the Hash/Equal functions.
2023-08-03 20:50:21 +02:00
Max Kellermann 9691b609a2 util/IntrusiveHashSet: remove_and_dispose() returns number of removed elements 2023-08-03 20:44:47 +02:00
Max Kellermann 250fa8c732 util/IntrusiveHashSet: rename remove_and_dispose() to remove_and_dispose_key() 2023-08-03 20:44:39 +02:00
Max Kellermann 2cd5f4cd3e util/IntrusiveHashSet: replace template parameters Hash/Equal with a single one
Preparing to add a key extraction function.  Without this "Operators"
template parameter, we'd have even more template parameters, and that
parameter list would grow too complex.  Better wrap it in one single
template that contains all operators.

This is an API change which all callers need to adjust to, but it will
be worth it.
2023-08-03 20:44:14 +02:00