#pragma once #include #include #include #include #include namespace stream::ranges { template class subrange { private: It begin_; S end_; public: subrange(It begin, S end) : begin_(begin), end_(end) {} template )> subrange(C && container) : subrange(std::begin(container), std::end(container)) { // TODO: permissible dangling static_assert(std::is_reference_v, "Cannot access iterator of a temporary"); } auto begin() const { return begin_; } auto end() const { return end_; } bool empty() const { return begin_ == end_; } SFINAE(detail::has_distance_to_v, size_t) size() const { return end_ - begin_; } }; template subrange(It, S) -> subrange; template subrange(C &&) -> subrange, detail::end_t>; } #include