// // common_view.h // stream // // Created by Sam Jaffe on 3/30/23. // #pragma once #include #include #define FWD(x) std::forward(x) namespace stream::ranges { template class common_view { private: S stream_; public: common_view(S && stream) : stream_(FWD(stream)) {} auto begin() const { return iterator::sentinal_iterator(stream_.begin()); } auto end() const { return decltype(begin())(); } bool empty() const { return stream_.empty(); } size_t size() const { return stream_.size(); } }; } namespace stream::ranges::views { struct common { template friend auto operator|(Stream && stream, common) { return common_view(FWD(stream)); } }; } #undef FWD