$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [mpl] is there a or_seq like logical metafunction?
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-02-10 13:45:24
----- Original Message -----
From: "Larry Evans" <cppljevans_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, February 08, 2009 2:50 PM
Subject: Re: [boost] [mpl] is there a or_seq like logical metafunction?
>
> On 02/07/09 13:58, Larry Evans wrote:
>> On 02/07/09 13:29, vicente.botet wrote:
> [snip]
>>> After suggestion of I don't remember who, I have implemented it as
>>>
>>> /* Calculate the mlp::and_ of a sequence of nullary logical
>>> metafunctions.*/ template <typename Seq>
>>> struct and_seq : boost::is_same<typename mpl::find_if<Seq,
>>> mpl::not_<mpl::_> >::type, typename mpl::end<Seq>::type>
>>> {};
>> [snip]
>>>
>>> If there are better ways to do that, you don't tink that this must be
>>> encapsulated in the library? Why not add these metafunctions in
>>> Boost.MPL?
>>>
>>> Thanks,
>>
>> OOPS. I misread the post. I was just thinking of and_ and or_.
>> I missed the "sequence of nullary logical metafunctions".
>> Sorry for noise. It just seemed so similar I neglected
>> any differences.
>
> Aren't true_ and false_ nullary logical metafunctions. If
> so then I think what you're requiring is someway to
> "unpack" the args from Seq<T1,T2,...Tn> into and_<T1,T2,...,Tn>
> or or_<T1,T2,...,Tn>. Could:
>
> http://www.boost.org/doc/libs/1_37_0/libs/mpl/doc/refmanual/unpack-args.html
>
> be used to do that?
Oh! this is quite interesting. I will try it to see how it works. WHich implementation should perdorms better if any difference?
> If not, then it's pretty easy to do that
> with the variadic version of mpl since all Sequences are
> derived from package<T1,T2,...,Tn> so:
>
> template<typename... T>
> or_seq<package<T...> >
> : or_<T...>
> {};
>
> A prototype variadic version of mpl is in the boost vault.
Thanks for the pointer,
Vicente