Boost logo

Boost Users :

Subject: Re: [Boost-users] [Range] Creating a range for a scoped_array (with known length)
From: Matthieu Brucher (matthieu.brucher_at_[hidden])
Date: 2010-11-05 06:34:24


2010/11/3 Thorsten Ottosen <nesotto_at_[hidden]>:
> Den 03-11-2010 14:56, Matthieu Brucher skrev:
>>
>> Hi,
>>
>> I have a scoped_array with some chars inside (so a
>> boost::scoped_array<char>). I want to use the string algorithms, but I
>> can't managed to get a range from the scoped_array.
>> I don't know if the data ends with a '\0' (it's received from asio
>> with a read()), so I can't rely on as_literal.
>>
>> Is there a way of creating a Range directly with two iterators?
>
>
>  boost::make_iterator_range( <begin>, <end> )

Hi,

Indeed, it is as simple as this. The issue I also faced is that the
string algorithms expect a reference to an iterator, so I had to build
it before, and not use a temporary.

Thanks,

Matthieu

-- 
Information System Engineer, Ph.D.
Blog: http://matt.eifelle.com
LinkedIn: http://www.linkedin.com/in/matthieubrucher

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net