Debian Codegraph @

libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/enable_borrowed_range.compile.pass.cpp

raw
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: no-filesystem
11 // UNSUPPORTED: availability-filesystem-missing
12
13 // <filesystem>
14
15 // template <>
16 // inline constexpr bool ranges::enable_borrowed_range<filesystem::directory_iterator> = true;
17 // template <>
18 // inline constexpr bool ranges::enable_borrowed_range<filesystem::recursive_directory_iterator> = true;
19
20 #include <filesystem>
21 #include <ranges>
22
23 template<class Range>
24 void test() {
25 static_assert(std::ranges::enable_borrowed_range<Range>);
26 static_assert(!std::ranges::enable_borrowed_range<Range&>);
27 static_assert(!std::ranges::enable_borrowed_range<const Range>);
28 }
29
30 void test() {
31 test<std::filesystem::directory_iterator>();
32 test<std::filesystem::recursive_directory_iterator>();
33 }