- ranges[meta header]
- std::ranges[meta namespace]
- variable[meta id-type]
- cpp20[meta cpp]
namespace std::ranges {
template<class I, class S, subrange_kind K>
inline constexpr bool enable_borrowed_range<subrange<I, S, K>> = true;
}
- subrange[link ../subrange.md]
この特殊化により、subrange
がborrowed_range
となる。
#include <ranges>
int main()
{
constexpr int a[] = {1, 2};
const std::ranges::subrange sub(a);
static_assert(std::ranges::borrowed_range<decltype(sub)>);
}
- C++20
- Clang: 13.0.0 [mark verified]
- GCC: 10.1.0 [mark verified]
- ICC: ?
- Visual C++: 2019 Update 10 [mark verified]