[libcxx-commits] [libcxx] [libc++] Add __pointer_int_pair (PR #94324)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 6 09:15:29 PDT 2024


================
@@ -0,0 +1,104 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <__utility/pointer_int_pair.h>
+#include <cassert>
+
+template <class Ptr, class UnderlyingType>
+using single_bit_pair = std::__pointer_int_pair<Ptr, UnderlyingType, std::__integer_width{1}>;
+
+template <class Ptr, class UnderlyingType>
+using two_bit_pair = std::__pointer_int_pair<Ptr, UnderlyingType, std::__integer_width{2}>;
+
+constinit single_bit_pair<int*, size_t> continitiable_pointer_int_pair;
+
+int main(int, char**) {
+  { // __point_int_pair() constructor
----------------
ldionne wrote:

```suggestion
  { // __pointer_int_pair() constructor
```

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


More information about the libcxx-commits mailing list