[multiprecision] Creation from a range
Hi John, hi all, Is there any way to create an Integer (or a number) from a range (bounded or counted)?; or from a string_view (string_ref)? Roughly speaking, something like: XintXXX_t make_from_bounded_range(I f, I l); XintXXX_t make_from_counted_range(I f, size_t n); If not exist, I can make a contribution, are you interested? Thank you very much and best regards, Fernando Pelliccioni.
Is there any way to create an Integer (or a number) from a range (bounded or counted)?; or from a string_view (string_ref)?
Roughly speaking, something like:
XintXXX_t make_from_bounded_range(I f, I l); XintXXX_t make_from_counted_range(I f, size_t n);
What are the semantics? Is this a measure? Like an integer distance between borders?
On Tue, Jan 5, 2016 at 12:50 AM, Damian Vicino
Is there any way to create an Integer (or a number) from a range (bounded or counted)?; or from a string_view (string_ref)?
Roughly speaking, something like:
XintXXX_t make_from_bounded_range(I f, I l); XintXXX_t make_from_counted_range(I f, size_t n);
What are the semantics?
I want to extract integers from a range (range of characters). Consider:
char buff[] = "12345 67890"; auto a =
make_from_bounded_range
Is this a measure? Like an integer distance between borders?
I don't understand these questions. The numbers could be anything.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
I want to extract integers from a range (range of characters). Consider:
char buff[] = "12345 67890"; auto a = make_from_bounded_range
(buff, buff + 5); auto b = make_from_counted_range (buff, 5); auto c = make_from_bounded_range (buff + 6, buff + 6 + 5); auto d = make_from_counted_range (buff + 6, 5); cout << a << '\n' << b << '\n' << c << '\n' << d << '\n'; Prints: 12345 12345 67890 67890
How can I do this today with Boost multiprecision? I don't want to copy characters to a temporal buffer.
I would say this is a string-stream problem - what you want to do is create a stream which doesn't copy the data - there's an example here: https://github.com/boostorg/regex/blob/develop/include/boost/regex/v4/cpp_re... which you could cut and paste to do the job? John.
participants (3)
-
Damian Vicino
-
Fernando Pelliccioni
-
John Maddock