Skip to content

Commit d49e736

Browse files
[libc++] Guard uses of is_transparent and iterator_concept
Before C++14/20, `is_transparent` and `iterator_concept` were not reserved at all respectively, and users might define them as macros.
1 parent 6c9b594 commit d49e736

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

libcxx/include/__filesystem/path_iterator.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class _LIBCPP_EXPORTED_FROM_ABI path::iterator {
3737

3838
public:
3939
typedef input_iterator_tag iterator_category;
40-
typedef bidirectional_iterator_tag iterator_concept;
40+
# if _LIBCPP_STD_VER >= 20
41+
using iterator_concept = bidirectional_iterator_tag;
42+
# endif
4143

4244
typedef path value_type;
4345
typedef ptrdiff_t difference_type;

libcxx/include/__functional/identity.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ struct __identity {
3030
return std::forward<_Tp>(__t);
3131
}
3232

33+
#if _LIBCPP_STD_VER >= 14
3334
using is_transparent = void;
35+
#endif
3436
};
3537

3638
template <>

libcxx/include/__iterator/iterator_traits.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,16 +351,20 @@ struct iterator_traits<_Tp*> {
351351
template <class _Tp>
352352
using __iterator_category _LIBCPP_NODEBUG = typename _Tp::iterator_category;
353353

354+
#if _LIBCPP_STD_VER >= 20
354355
template <class _Tp>
355356
using __iterator_concept _LIBCPP_NODEBUG = typename _Tp::iterator_concept;
357+
#endif
356358

357359
template <class _Tp, class _Up>
358360
using __has_iterator_category_convertible_to _LIBCPP_NODEBUG =
359361
is_convertible<__detected_or_t<__nat, __iterator_category, iterator_traits<_Tp> >, _Up>;
360362

363+
#if _LIBCPP_STD_VER >= 20
361364
template <class _Tp, class _Up>
362365
using __has_iterator_concept_convertible_to _LIBCPP_NODEBUG =
363366
is_convertible<__detected_or_t<__nat, __iterator_concept, _Tp>, _Up>;
367+
#endif
364368

365369
template <class _Tp>
366370
using __has_input_iterator_category _LIBCPP_NODEBUG = __has_iterator_category_convertible_to<_Tp, input_iterator_tag>;

0 commit comments

Comments
 (0)