#include <algorithm>
#include <cassert>
#include <concepts>
#include <iostream>
#include <ranges>
#include <span>
#include <vector>

int main() {
    int owner[] = {10, 20, 30};
    std::span<int> view(owner);
    static_assert(std::ranges::borrowed_range<std::span<int>>);
    static_assert(!std::ranges::borrowed_range<std::vector<int>>);
    using TemporaryResult = decltype(std::ranges::find(std::vector<int>{1, 2}, 2));
    static_assert(std::same_as<TemporaryResult, std::ranges::dangling>);
    auto position = std::ranges::find(view, 20);
    assert(position != view.end());
    assert(*position == 20);
    std::cout << "borrowed range ok\n";
}
