@@ -296,16 +296,8 @@ struct __forward_node_traits {
296
296
# endif
297
297
298
298
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI static __begin_node_pointer __as_iter_node (__node_pointer __p) {
299
- # ifdef _LIBCPP_CXX03_LANG
300
- return static_cast <__begin_node_pointer>(__p);
301
- # else
302
- if constexpr (std::is_pointer<__begin_node_pointer>::value) {
303
- return static_cast <__begin_node_pointer>(__p);
304
- } else {
305
- return __p ? __begin_node_pointer::pointer_to (*static_cast <__begin_node*>(std::addressof (*__p)))
306
- : static_cast <__begin_node_pointer>(nullptr );
307
- }
308
- # endif
299
+ return __p ? pointer_traits<__begin_node_pointer>::pointer_to (*static_cast <__begin_node*>(std::addressof (*__p)))
300
+ : static_cast <__begin_node_pointer>(nullptr );
309
301
}
310
302
};
311
303
@@ -320,16 +312,9 @@ struct __forward_begin_node {
320
312
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit __forward_begin_node (pointer __n) : __next_(__n) {}
321
313
322
314
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __next_as_begin () const {
323
- # ifdef _LIBCPP_CXX03_LANG
324
- return static_cast <__begin_node_pointer>(__next_);
325
- # else
326
- if constexpr (std::is_pointer<__begin_node_pointer>::value) {
327
- return static_cast <__begin_node_pointer>(__next_);
328
- } else {
329
- return __next_ ? __begin_node_pointer::pointer_to (*static_cast <__forward_begin_node*>(std::addressof (*__next_)))
330
- : static_cast <__begin_node_pointer>(nullptr );
331
- }
332
- # endif
315
+ return __next_ ? pointer_traits<__begin_node_pointer>::pointer_to (
316
+ *static_cast <__forward_begin_node*>(std::addressof (*__next_)))
317
+ : static_cast <__begin_node_pointer>(nullptr );
333
318
}
334
319
};
335
320
@@ -385,17 +370,8 @@ class _LIBCPP_TEMPLATE_VIS __forward_list_iterator {
385
370
386
371
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin () const { return __ptr_; }
387
372
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __node_pointer __get_unsafe_node_pointer () const {
388
- # ifdef _LIBCPP_CXX03_LANG
389
- return static_cast <__node_pointer>(__ptr_);
390
- # else
391
- if constexpr (std::is_pointer<__node_pointer>::value) {
392
- return static_cast <__node_pointer>(__ptr_);
393
- } else {
394
- return __ptr_ ? __node_pointer::pointer_to (
395
- *static_cast <__node_type*>(const_cast <__begin_node_type*>(std::addressof (*__ptr_))))
396
- : static_cast <__node_pointer>(nullptr );
397
- }
398
- # endif
373
+ return __ptr_ ? pointer_traits<__node_pointer>::pointer_to (*static_cast <__node_type*>(std::addressof (*__ptr_)))
374
+ : static_cast <__node_pointer>(nullptr );
399
375
}
400
376
401
377
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit __forward_list_iterator (nullptr_t ) _NOEXCEPT
@@ -464,17 +440,8 @@ class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator {
464
440
465
441
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin () const { return __ptr_; }
466
442
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __node_pointer __get_unsafe_node_pointer () const {
467
- # ifdef _LIBCPP_CXX03_LANG
468
- return static_cast <__node_pointer>(__ptr_);
469
- # else
470
- if constexpr (std::is_pointer<__node_pointer>::value) {
471
- return static_cast <__node_pointer>(__ptr_);
472
- } else {
473
- return __ptr_ ? __node_pointer::pointer_to (
474
- *static_cast <__node_type*>(const_cast <__begin_node_type*>(std::addressof (*__ptr_))))
475
- : static_cast <__node_pointer>(nullptr );
476
- }
477
- # endif
443
+ return __ptr_ ? pointer_traits<__node_pointer>::pointer_to (*static_cast <__node_type*>(std::addressof (*__ptr_)))
444
+ : static_cast <__node_pointer>(nullptr );
478
445
}
479
446
480
447
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit __forward_list_const_iterator (nullptr_t ) _NOEXCEPT
@@ -547,27 +514,12 @@ protected:
547
514
_LIBCPP_COMPRESSED_PAIR (__begin_node, __before_begin_, __node_allocator, __alloc_);
548
515
549
516
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __before_begin () _NOEXCEPT {
550
- # ifdef _LIBCPP_CXX03_LANG
551
517
return pointer_traits<__begin_node_pointer>::pointer_to (__before_begin_);
552
- # else
553
- if constexpr (std::is_pointer<__begin_node_pointer>::value) {
554
- return std::addressof (__before_begin_);
555
- } else {
556
- return __begin_node_pointer::pointer_to (*std::addressof (__before_begin_));
557
- }
558
- # endif
559
518
}
560
519
561
520
_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __before_begin () const _NOEXCEPT {
562
- # ifdef _LIBCPP_CXX03_LANG
563
- return pointer_traits<__begin_node_pointer>::pointer_to (const_cast <__begin_node&>(__before_begin_));
564
- # else
565
- if constexpr (std::is_pointer<__begin_node_pointer>::value) {
566
- return const_cast <__begin_node*>(std::addressof (__before_begin_));
567
- } else {
568
- return __begin_node_pointer::pointer_to (*const_cast <__begin_node*>(std::addressof (__before_begin_)));
569
- }
570
- # endif
521
+ return pointer_traits<__begin_node_pointer>::pointer_to (
522
+ *const_cast <__begin_node*>(std::addressof (__before_begin_)));
571
523
}
572
524
573
525
typedef __forward_list_iterator<__node_pointer> iterator;
0 commit comments