[libcxx-commits] [libcxx] [libc++] Slightly simplify max_size and add new tests for vector (PR #119990)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jan 29 09:39:39 PST 2025
================
@@ -10,16 +10,36 @@
// size_type max_size() const;
+#include <algorithm>
#include <cassert>
+#include <cstdint>
#include <limits>
#include <type_traits>
#include <vector>
+#include "min_allocator.h"
+#include "sized_allocator.h"
#include "test_allocator.h"
#include "test_macros.h"
+#if TEST_STD_VER >= 11
-TEST_CONSTEXPR_CXX20 bool test() {
+template <typename T, typename Alloc>
+TEST_CONSTEXPR_CXX20 void test(const std::vector<T, Alloc>& v) {
+ using Vector = std::vector<T, Alloc>;
+ using alloc_traits = typename Vector::__alloc_traits;
----------------
ldionne wrote:
```suggestion
using alloc_traits = std::allocator_traits<typename Vector::allocator_type>;
```
To stay portable.
https://github.com/llvm/llvm-project/pull/119990
More information about the libcxx-commits
mailing list