|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2007-03-29 21:52:39
on Thu Mar 29 2007, Scott Meyers <usenet-AT-aristeia.com> wrote:
> David Abrahams wrote:
>> Yeah, why struggle? This problem looks tailor-made for filter_view.
>
> Skipping over the struggling comment (it's not like I'm deliberately choosing
> it),
Sorry.
> what makes filter_view a better choice? With both implementations, doesn't
> eraseVal::type yield a new sequence?
I didn't look too closely at what
template<typename Seq, typename T>
struct eraseVal
: mpl::eval_if<
boost::is_same<typename mpl::find<Seq, T>::type,
typename mpl::end<Seq>::type>,
typename mpl::identity<Seq>::type,
eraseVal<typename mpl::erase<Seq,
typename mpl::find<Seq,T>::type,
typename mpl::next<typename mpl::find<Seq,T>::type>::type
>::type,
T>
>
{};
was doing, but it seemed like a much bigger struggle than
template<typename Seq, typename T>
struct eraseVal
: filter_view<Seq, mpl::not_<boost::is_same<_, T> > >
{};
> If filter_view<Seq, Pred> is always better than copy_if<Seq, Pred>,
> why do we need both?
Oh, I didn't see copy_if anywhere. I'm not sure filter_view is always
better, but the question of why we need both has definitely crossed my
mind, and I don't have a good answer.
-- Dave Abrahams Boost Consulting www.boost-consulting.com Don't Miss BoostCon 2007! ==> http://www.boostcon.com
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