1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // UNSUPPORTED: c++03, c++11, c++14, c++17 10 // UNSUPPORTED: libcpp-no-concepts 11 // UNSUPPORTED: gcc-10 12 13 // ranges::next 14 // Make sure we're SFINAE-friendly when the template argument constraints are not met. 15 16 #include <iterator> 17 18 #include <cstddef> 19 #include <memory> 20 #include <utility> 21 #include "test_iterators.h" 22 23 template <class ...Args> 24 concept has_ranges_next = requires (Args&& ...args) { 25 { std::ranges::next(std::forward<Args>(args)...) }; 26 }; 27 28 using It = std::unique_ptr<int>; 29 static_assert(!has_ranges_next<It>); 30 static_assert(!has_ranges_next<It, std::ptrdiff_t>); 31 static_assert(!has_ranges_next<It, It>); 32 static_assert(!has_ranges_next<It, std::ptrdiff_t, It>); 33 34 // Test the test 35 using It2 = forward_iterator<int*>; 36 static_assert(has_ranges_next<It2>); 37 static_assert(has_ranges_next<It2, std::ptrdiff_t>); 38 static_assert(has_ranges_next<It2, std::ptrdiff_t, It2>); 39