Boost logo

Boost :

From: Atry (pop.atry_at_[hidden])
Date: 2007-08-17 05:52:15


And I request for another feature: lexical_range.
For example, if I need to generate a http request url, I would write:

const char* host = "www.my-host.com";
unsinged short port = 8080;
unsigned int id = 12345;
new http_request("http://" | jointed(host) | jointed(single(':')) |
jointed(lexical_cast<string>(port)) | jointed("/query?id=") |
jointed(lexical_cast<string>(id)));

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.

On 8/17/07, Atry <pop.atry_at_[hidden]> wrote:
>
> When I use utf8_encoded, I am very strange that passing a wchar_t range to
> utf8_encoded is error on windows.
> You write BOOST_STATIC_ASSERT(sizeof(base_value_t)*CHAR_BIT == 32); But
> wchar_t is 16 bits length on windows. I have to write some like this:
>
> 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;
>
>
> On 8/17/07, shunsuke <pstade.mb_at_[hidden]> wrote:
> >
> > Atry wrote:
> > > Sorry, I have not seen streambuf_read one day before.
> > > I want to write a lazy encoder like utf_encoded, when I see your
> > source, I
> > > found pstade.egg, it seems egg provider the base of your lisp like
> > function,
> > > could you please add a little document for egg, I am realy interesting
> > in
> > > the function style.
> >
> > Egg is a set of higher-order functions which work with boost::result_of.
> > Fortunately I'm now documenting Egg just for myself. :-)
> > Though I cannot promise it, oven rev.3 might include the document.
> >
> >
> > 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