Boost logo

Boost Users :

Subject: Re: [Boost-users] [range] unique
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-02-22 20:23:42


AMDG

On 02/22/2012 04:31 PM, Bill Buklis wrote:
>
> Given that std::unique returns an iterator to the first non-unique value
> you can do something like:
>
> vec.erase( std::unique(vec.begin(), vec.end(), vec.end() );
>
> However, boost::unique returns the range of the "unique" values. I would
> expect instead that it would return the range of non-unique values so
> that it matched the standard algorithm version, which effectively
> returns the range of non-unique values. Correspondingly trying:
>
> boost::erase( vec, boost::unique(vec) );
>
> eliminates the complete opposite of what the standard version does. I
> can get around this by calling:
>
>

According to http://tinyurl.com/86arysc, what you want is
boost::erase(vec, boost::unique<boost::return_found_end>(vec))

In Christ,
Steven Watanabe


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