#pragma once namespace stream { namespace detail { template class source_stream : public stream_impl { public: typedef typename C::value_type value_type; class iterator : public iterator_impl { public: typedef iterator_impl super; explicit iterator(typename C::iterator it) : impl_(it) {} ~iterator() {} value_type operator*() override { return *impl_; } DELEGATE_ITERATOR_IMPL(impl_) private: typename C::iterator impl_; }; explicit source_stream(C const& cont) : source_(cont) {} explicit source_stream(C && cont) : source_(std::forward(cont)) {} ~source_stream() override {} ::stream::iterator begin() override { return new iterator{source_.begin()}; } ::stream::iterator end() override { return new iterator{source_.end()}; } private: C source_; }; } template detail::stream_base make_stream(C const& cont) { return detail::stream_base{new detail::source_stream{cont}}; } }