Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
IterableToInputStream.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Streams_IterableToInputStream_h_
5#define _Stroika_Foundation_Streams_IterableToInputStream_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
11
12/**
13 * \file
14 *
15 * \note Code-Status: <a href="Code-Status.md#Beta">Beta</a>
16 *
17 */
18
19namespace Stroika::Foundation::Streams::IterableToInputStream {
20
21 using InputStream::Ptr;
22
23 /**
24 * Sometimes, convenient to take an object which is Iterable, and treat it as an InputStream<> (similar but not identical concepts).
25 *
26 * For example, this can be used to treat a String as an InputStream<Character>.
27 *
28 * \par Example Usage
29 * \code
30 * InputStream::Ptr<Character> in = IterableToInputStream::New<Character> (String{"hi"});
31 * \endcode
32 */
33 template <typename ELEMENT_TYPE>
34 auto New (const Traversal::Iterable<ELEMENT_TYPE>& it) -> Ptr<ELEMENT_TYPE>;
35
36}
37
38/*
39 ********************************************************************************
40 ***************************** Implementation Details ***************************
41 ********************************************************************************
42 */
43#include "IterableToInputStream.inl"
44
45#endif /*_Stroika_Foundation_Streams_IterableToInputStream_h_*/