[libcxx-commits] [libcxx] [libc++] Make list constexpr as part of P3372R3 (PR #129799)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 10 08:23:14 PDT 2025
================
@@ -332,10 +338,14 @@ public:
typedef __list_node_base<_Tp, _VoidPtr> __base;
typedef typename __base::__base_pointer __base_pointer;
- _LIBCPP_HIDE_FROM_ABI explicit __list_node(__base_pointer __prev, __base_pointer __next) : __base(__prev, __next) {}
- _LIBCPP_HIDE_FROM_ABI ~__list_node() {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit __list_node(__base_pointer __prev, __base_pointer __next)
+ : __base(__prev, __next) {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI ~__list_node() {}
- _LIBCPP_HIDE_FROM_ABI __base_pointer __as_link() { return __base::__self(); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __base_pointer __as_link() {
+ return pointer_traits<__base_pointer>::pointer_to(
+ *static_cast<typename pointer_traits<__base_pointer>::element_type*>(std::addressof(*this)));
----------------
ldionne wrote:
```suggestion
*static_cast<typename pointer_traits<__base_pointer>::element_type*>(this));
```
That should be strictly simpler but equivalent?
https://github.com/llvm/llvm-project/pull/129799
More information about the libcxx-commits
mailing list