[libcxx-commits] [PATCH] D117736: [libc++][P2321R2] Add vector<bool>::reference::operator=(bool) const
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 31 10:47:31 PST 2022
philnik added inline comments.
================
Comment at: libcxx/test/std/containers/sequences/vector.bool/reference/assign_bool.pass.cpp:41
return true;
}
----------------
Quuxplusone wrote:
> It might be a good idea to add a more motivating test case in addition to this simple one. I'm thinking something like https://godbolt.org/z/T1f3rzejs , although it's still not crazy good as an example. I wonder if @BRevzin knows a better motivating example off the top of his head.
> ```
> template<class T>
> void test(T t) {
> std::vector<T> v = {t};
> const typename std::vector<T>::reference r = v[0]; // const-qualifying a reference type is a no-op
> r = t; // therefore this should work consistently for T=int and T=bool
> }
> ```
> ...Aha, you should also update `std/containers/sequences/vector.bool/iterator_concept_conformance.compile.pass.cpp` because this should now be true, not false!
> ```
> static_assert(std::indirectly_writable<std::vector<bool>::iterator, bool>);
> ```
> That might be a sufficiently "motivating" example.
Did you miss the `iterator_concept_conformance.compile.pass.cpp` diff? Is that enough?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117736/new/
https://reviews.llvm.org/D117736
More information about the libcxx-commits
mailing list