Function Subspace :: sus :: iter :: try_from_iter
template <class C, class IntoIter, int &... , class FromType = typename IntoIteratorOutputType<IntoIter>::Item, class ToType = ::sus::ops::TryRemapOutputType<FromType, C>>
auto try_from_iter(IntoIter&& into_iter) -> ToType
requires
sus::iter::IntoIteratorAny<IntoIter>
sus::ops::Try<FromType>
sus::iter::FromIterator<C, ::sus::ops::TryOutputType<FromType>>
!std::is_void_v<::sus::ops::TryOutputType<FromType>>
sus::mem::IsMoveRef<decltype(into_iter)>
Constructs ToType
from a type that can be turned into an Iterator
over
elements of type ItemType
.
If a failure value is seen in the iterator, then the failure value will be
returned. Otherwise, the ToType
success type (TryOutputType<ToType>
) is
constructed from the success values in the Iterator, and a
success-representing ToType
is returned containing that success type.
This is the other end of
Iterator::try_collect()
, and is
typically called through calling try_collect()
on an iterator. However
this function can be preferrable for some readers, especially in generic
template code.