|
Boost : |
From: shunsuke (pstade.mb_at_[hidden])
Date: 2007-08-17 08:42:33
Atry wrote:
> All string operation are lazy but lexical_cast. If there is a lexical_range,
> I can write:
> new http_request("http://" | jointed(host) | jointed(single(':')) |
> jointed(make_lexical_range<char>(port)) | jointed("/query?id=") |
> jointed(make_lexical_range<char>(id)));
>
> The make_lexical_range will be faster than lexical_cast, and requires no
> heap allocate.
I'm not sure how to implement such a range adaptor.
>> struct static_cast_to_u32 {
>> typedef uint32_t result_type;
>> result_type operator()(wchar_t c) const {
>> return static_cast<result_type>(c);
>> }
>> };
>>
>> u16_string | transformed(static_cast_to_u32()) | utf8_encoded;
In fact, that is a cut and paste from
<boost/regex/pending/unicode_iterator.hpp>,
so I don't understand it exactly.
But that assertion seems a good practice.
BTW, a null-terminated char pointer is no longer a range.
See oven::as_c_str, as_literal and as_array.
Regards,
-- Shunsuke Sogame
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk