Skip to content

Commit f5ad724

Browse files
committed
Avoid <concepts> for Clang-13.
1 parent b292728 commit f5ad724

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/support/graph_traversal.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17+
#if __cplusplus >= 202002L
1718
#include <concepts>
19+
#endif
1820
#include <functional>
1921
#include <iterator>
2022
#include <unordered_set>
@@ -32,8 +34,12 @@ namespace wasm {
3234
// successors([](const T&) { }, t); }
3335
template<typename T, typename SuccessorFunction> class Graph {
3436
public:
37+
#if defined(__cpp_lib_concepts)
3538
template<std::input_iterator It, std::sentinel_for<It> Sen>
3639
requires std::convertible_to<std::iter_reference_t<It>, T>
40+
#else
41+
template<typename It, typename Sen>
42+
#endif
3743
Graph(It rootsBegin, Sen rootsEnd, SuccessorFunction successors)
3844
: roots(rootsBegin, rootsEnd), successors(std::move(successors)) {}
3945

@@ -66,10 +72,17 @@ template<typename T, typename SuccessorFunction> class Graph {
6672
SuccessorFunction successors;
6773
};
6874

75+
#if defined(__cpp_lib_concepts)
6976
template<std::input_iterator It,
7077
std::sentinel_for<It> Sen,
7178
typename SuccessorFunction>
7279
Graph(It, Sen, SuccessorFunction)
7380
-> Graph<std::iter_value_t<It>, std::decay_t<SuccessorFunction>>;
81+
#else
82+
template<typename It, typename Sen, typename SuccessorFunction>
83+
Graph(It, Sen, SuccessorFunction)
84+
-> Graph<typename std::iterator_traits<It>::value_type,
85+
std::decay_t<SuccessorFunction>>;
86+
#endif
7487

7588
} // namespace wasm

0 commit comments

Comments
 (0)