Boost logo

Boost :

From: Atry (pop.atry_at_[hidden])
Date: 2007-08-25 13:25:26


On 8/17/07, shunsuke <pstade.mb_at_[hidden]> wrote:
>
> 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.

What about hold a streambuf in a lexical_range? By the way that streambuf
should be stack-based.

>> 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.

Ah, it seems that you forget to copy u16_to_u32_iterator...

BTW, a null-terminated char pointer is no longer a range.
> See oven::as_c_str, as_literal and as_array.
>
>
> Regards,
>
> --
> Shunsuke Sogame
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk