[libcxx-commits] [libcxx] [libcxx] improves diagnostics for containers with bad value types (PR #106296)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 29 13:08:41 PDT 2024


================
@@ -468,6 +475,13 @@ const _DiffType __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer,
 
 template <class _Tp, class _Allocator /*= allocator<_Tp>*/>
 class _LIBCPP_TEMPLATE_VIS deque {
+  static_assert(!is_const<_Tp>::value, "'std::deque' cannot hold const types");
----------------
ldionne wrote:

I would like to centralize these checks in some way, since they seem to all basically come from the same container requirements in the standard. If we ever change those requirements, it's almost certain that containers will get out of sync unless we centralize these checks.

https://github.com/llvm/llvm-project/pull/106296


More information about the libcxx-commits mailing list