
on Thu Mar 29 2007, "Ovanes Markarian"
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
struct eraseVal2:mpl::copy_if 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.
Yeah, why struggle? This problem looks tailor-made for filter_view. -- Dave Abrahams Boost Consulting www.boost-consulting.com Don't Miss BoostCon 2007! ==> http://www.boostcon.com