Boost logo

Boost :

From: Shunsuke Sogame (mb2act_at_[hidden])
Date: 2006-07-07 04:24:41


Sean Parent wrote:
> On Jul 5, 2006, at 10:15 PM, boost-request_at_[hidden] wrote:
>
>> std::string s = get_some_utf_8_xml_data();
>>
>> utf_range r = boost::find(utf_range(s), UL0x0000FEFF);
>>
>> assert(*r.begin().base() == U0xEF);
>
> Not sure why find would return a range - but so long as I can also
> use it with standard algorithms, and it generates efficient code I'm
> happy.

I recall the discussion about
what range-algorithms should return.
My current answer is:

     std::string src("abcdefghijk");
     namespace ph = boost::phoenix; // version2
     {
         std::string s1("efg");
         BOOST_CHECK((
             equals(
                 std::string("efghijk"),
                 src|applied(ph::search(rng1, s1), end)
             )
         ));
     }

Users specify it by using lambda expression.

-- 
Shunsuke Sogame

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