|
Boost Users : |
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2007-03-29 04:27:01
On Thu, March 29, 2007 09:28, Joaquín Mª López Muñoz wrote:
[snip ...]
>
> This works, but it is quite inefficient, as mpl::find, which computes
> in linear time, is called for every element of Seq. The same thing
> can be done in one pass through the sequence as follows:
>
> template<typename Seq,typename T>
> struct eraseVal2:mpl::copy_if<Seq,mpl::not_<boost::is_same<mpl::_,T> > >
> {};
>
> Please find attached a compilable snippet showing both algorithms
> at work.
>
> HTH,
>
> Joaquín M López Muñoz
> Telefónica, Investigación y Desarrollo
Another approach would be to use the filter_view, without copying the elements.
With Kind Regards,
Ovanes Markarian
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