[libcxx-commits] [libcxx] [libc++] Remove unnecessary static_casts in std::forward_list (PR #130310)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sat Mar 8 01:30:44 PST 2025


================
@@ -363,12 +363,8 @@ class _LIBCPP_TEMPLATE_VIS __forward_list_iterator {
 
   __begin_node_pointer __ptr_;
 
-  _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin() const {
-    return static_cast<__begin_node_pointer>(static_cast<__void_pointer>(__ptr_));
-  }
-  _LIBCPP_HIDE_FROM_ABI __node_pointer __get_unsafe_node_pointer() const {
-    return static_cast<__node_pointer>(static_cast<__void_pointer>(__ptr_));
-  }
+  _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin() const { return __ptr_; }
+  _LIBCPP_HIDE_FROM_ABI __node_pointer __get_unsafe_node_pointer() const { return static_cast<__node_pointer>(__ptr_); }
----------------
philnik777 wrote:

These probably as well, but I'm a bit less sure about them.

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


More information about the libcxx-commits mailing list