MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ parse_tuple()

template<typename T, size_t N>
std::optional< std::array< T, N > > MayaFlux::Reflect::parse_tuple ( std::string_view source,
TextError & error )
nodiscard

Parse exactly N whitespace separated finite numbers.

Parameters
errorReceives Invalid for a malformed token and Cardinality for a wrong count.

Definition at line 55 of file TextCodec.hpp.

57{
58 const auto values = parse_numbers<T>(source);
59 if (!values) {
60 error = TextError::Invalid;
61 return std::nullopt;
62 }
63 if (values->size() != N) {
65 return std::nullopt;
66 }
67 std::array<T, N> result;
68 std::ranges::copy(*values, result.begin());
69 return result;
70}
std::optional< std::vector< T > > parse_numbers(std::string_view source)
Parse whitespace separated finite numbers.
Definition TextCodec.hpp:17

References Cardinality, Invalid, and parse_numbers().

Referenced by MayaFlux::Reflect::TextCodec< Kinesis::AABB2D >::decode(), and MayaFlux::Reflect::TextCodec< T >::decode().

Here is the call graph for this function:
Here is the caller graph for this function: