[libc-commits] [PATCH] D100732: [libc] Enhance ArrayRef + unittests
Guillaume Chatelet via Phabricator via libc-commits
libc-commits at lists.llvm.org
Sun Apr 18 12:58:30 PDT 2021
gchatelet created this revision.
gchatelet added a reviewer: sivachandra.
Herald added subscribers: libc-commits, ecnelises, tschuett, mgorny.
Herald added a project: libc-project.
gchatelet requested review of this revision.
This patch mostly adds unittests for `ArrayRef` and `MutableArrayRef`, additionnaly:
- We mimic the behavior of `std::vector` and disallow CV qualified type (`ArrayRef<const X>` is not allowed). This is to make sure that the type traits are always valid (e.g. `value_type`, `pointer`, ...).
- In the previous implementation `ArrayRef` would define `value_type` as `const T` but this is not correct, it should be `T` for both `MutableArrayRef` and `ArrayRef`.
- We add the `equals` method to ease testing,
- We define the constructor taking an `Array` outside of the base implementation to ensure we match `const Array<T>&` and not `Array<const T>&` in the case of `ArrayRef`.
rG LLVM Github Monorepo
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 13090 bytes
Desc: not available
More information about the libc-commits