Support Class Library
A set of tools providing classes and utility
Namespaces | Functions
scl::stream::creators Namespace Reference

Namespace for functions and utilities that create streams (lazy) More...

Namespaces

 details
 Implementation details of creators.
 

Functions

template<class T , size_t N>
Stream< T > streamFrom (std::array< T, N > a)
 Create an scl::stream::Stream from a std::array. More...
 
template<class Char = char, class Traits = std::char_traits<Char>>
Stream< std::basic_string< Char, Traits > > streamFrom (std::basic_istream< Char, Traits > &inputStream)
 Create a stream from a std::basic_istream. More...
 
template<class T = int, class = scl::tools::meta ::enable_if_t< scl::tools::meta ::is_arithmetic<T>()>>
Stream< T > range (T from, T to, T step=1)
 Create an scl::stream::Stream for a specified range. More...
 
template<class T = int, class = scl::tools::meta ::enable_if_t< scl::tools::meta ::is_arithmetic<T>()>>
Stream< T > rangeTo (T to, T step=1)
 Range from 0 to the specified value. More...
 
template<class T = int, class = scl::tools::meta ::enable_if_t< scl::tools::meta ::is_arithmetic<T>()>>
Stream< T > rangeFrom (T from, T step=-1)
 Generate a range from the given value to 0. More...
 
template<class T = double, class = scl::tools::meta ::enable_if_t< scl::tools::meta ::is_arithmetic<T>() && std::numeric_limits<T>::has_infinity >>
Stream< T > infiniteRange (T from=0, T step=1)
 Generate a range from the given value to +inf. More...
 
template<class C , class It = typename C::iterator>
Stream< typename details::FromStlIterator< It >::value_type > streamFrom (C &container)
 Create a stream from a container. More...
 
template<class It >
Stream< typename details::FromStlIterator< It >::value_type > streamFrom (It begin, It end)
 Create a stream from a pair of iterators. More...
 

Detailed Description

Namespace for functions and utilities that create streams (lazy)

Function Documentation

◆ infiniteRange()

template<class T = double, class = scl::tools::meta ::enable_if_t< scl::tools::meta ::is_arithmetic<T>() && std::numeric_limits<T>::has_infinity >>
Stream<T> scl::stream::creators::infiniteRange ( from = 0,
step = 1 
)

Generate a range from the given value to +inf.

Template Parameters
Tbeing the type of the elements of the range
Parameters
frombeing the initial value
stepbeing the increment
Returns
a stream that generates the range's values

Definition at line 120 of file range.h.

◆ range()

template<class T = int, class = scl::tools::meta ::enable_if_t< scl::tools::meta ::is_arithmetic<T>()>>
Stream<T> scl::stream::creators::range ( from,
to,
step = 1 
)

Create an scl::stream::Stream for a specified range.

Template Parameters
Tbeing the type of the elements of the range
Parameters
frombeing the initial value
tobeing the last value
stepbeing the increment
Returns
a stream that generates the range's values

Definition at line 78 of file range.h.

◆ rangeFrom()

template<class T = int, class = scl::tools::meta ::enable_if_t< scl::tools::meta ::is_arithmetic<T>()>>
Stream<T> scl::stream::creators::rangeFrom ( from,
step = -1 
)

Generate a range from the given value to 0.

Template Parameters
Tbeing the type of the elements of the range
Parameters
frombeing the initial value
stepbeing the increment
Returns
a stream that generates the range's values

Definition at line 105 of file range.h.

◆ rangeTo()

template<class T = int, class = scl::tools::meta ::enable_if_t< scl::tools::meta ::is_arithmetic<T>()>>
Stream<T> scl::stream::creators::rangeTo ( to,
step = 1 
)

Range from 0 to the specified value.

Template Parameters
Tbeing the type of the elements of the range
Parameters
tobeing the last value
stepbeing the increment
Returns
a stream that generates the range's values

Definition at line 93 of file range.h.

◆ streamFrom() [1/4]

template<class C , class It = typename C::iterator>
Stream<typename details::FromStlIterator<It>::value_type> scl::stream::creators::streamFrom ( C &  container)

Create a stream from a container.

Template Parameters
Cbeing the container type
Itbeing the computed iterator type
Parameters
containerbeing the container to construct from
Returns
a stream that uses the container as data source

Definition at line 18 of file stl_containers.h.

◆ streamFrom() [2/4]

template<class Char = char, class Traits = std::char_traits<Char>>
Stream<std::basic_string<Char, Traits> > scl::stream::creators::streamFrom ( std::basic_istream< Char, Traits > &  inputStream)

Create a stream from a std::basic_istream.

Template Parameters
Charbeing the type of characters to use
Traitsbeing the traits for these characters
Parameters
inputStreambeing the std::basic_istream to read from
Returns
a Stream that uses the std::basic_istream as data source

Definition at line 52 of file istream.h.

◆ streamFrom() [3/4]

template<class It >
Stream<typename details::FromStlIterator<It>::value_type> scl::stream::creators::streamFrom ( It  begin,
It  end 
)

Create a stream from a pair of iterators.

Template Parameters
Itbeing the type of iterators
Parameters
beginbeing the begin iterator
endbeing the end iterator
Returns
a stream that emits the range's values

Definition at line 71 of file stl_iterators.h.

◆ streamFrom() [4/4]

template<class T , size_t N>
Stream<T> scl::stream::creators::streamFrom ( std::array< T, N >  a)

Create an scl::stream::Stream from a std::array.

Template Parameters
Tbeing the type of values
Nbeing the length of the array
Parameters
abeing the array
Returns
a stream that uses the array as its source of data

Definition at line 71 of file array.h.