Skip to content

Commit 5f0d959

Browse files
committed
Fix container_based_sequence on clang
1 parent 9812083 commit 5f0d959

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

include/oneapi/tbb/detail/_range_common.h

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2005-2021 Intel Corporation
2+
Copyright (c) 2005-2025 Intel Corporation
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -102,20 +102,23 @@ concept tbb_range = std::copy_constructible<Range> &&
102102
{ range.is_divisible() } -> relaxed_convertible_to<bool>;
103103
};
104104

105+
template <typename Iterator, typename IteratorTag>
106+
struct iterator_concept_helper;
107+
108+
// New specializations should be added in case of using container_based_sequence with
109+
// the new iterator tag types
105110
template <typename Iterator>
106-
constexpr bool iterator_concept_helper( std::input_iterator_tag ) {
107-
return std::input_iterator<Iterator>;
108-
}
111+
struct iterator_concept_helper<Iterator, std::input_iterator_tag> {
112+
static constexpr bool value = std::input_iterator<Iterator>;
113+
};
109114

110115
template <typename Iterator>
111-
constexpr bool iterator_concept_helper( std::random_access_iterator_tag ) {
112-
return std::random_access_iterator<Iterator>;
113-
}
116+
struct iterator_concept_helper<Iterator, std::random_access_iterator_tag> {
117+
static constexpr bool value = std::random_access_iterator<Iterator>;
118+
};
114119

115120
template <typename Iterator, typename IteratorTag>
116-
concept iterator_satisfies = requires (IteratorTag tag) {
117-
requires iterator_concept_helper<Iterator>(tag);
118-
};
121+
concept iterator_satisfies = iterator_concept_helper<Iterator, IteratorTag>::value;
119122

120123
template <typename Sequence, typename IteratorTag>
121124
concept container_based_sequence = requires( Sequence& seq ) {

0 commit comments

Comments
 (0)