xte::big_int<T>::parse.with_index()

Defined in header <xte/math/big_int.hpp>


Definition

template<xte::is_int Radix = xte::uz>
[[nodiscard]] static constexpr auto with_index(xte::string_view string, Radix radix = 10, const xte::number_format_config& config = {}) noexcept(false);
Same as xte::big_int<T>::parse.operator()(), but returns a struct containing non-static data members value and index, which hold the parsed big-integer and the index at which parsing stopped, respectively.



Example

auto [value, index] = xte::big_int<>::parse.with_index("-123a");
std::println("value = {}", value);
std::println("index = {}", index);
Output:
value = -123
index = 4
[View in Compiler Explorer]