Boost logo

Boost Users :

From: Daniel Wallin (daniel_at_[hidden])
Date: 2007-07-27 16:10:21


JOAQUIN LOPEZ MU?Z wrote:
>
> ----- Mensaje original -----
> De: Daniel Wallin <daniel_at_[hidden]>
> Fecha: Viernes, Julio 20, 2007 0:11 am
> Asunto: Re: [Boost-users] [parameter] Parameter-Enabled Class
> Templates:combining keyword and deduction for the same parameter
> Para: boost-users_at_[hidden]
>
>> David Abrahams wrote:
>>> on Thu Jul 19 2007, "JOAQUIN LOPEZ MU?Z" <joaquin-AT-tid.es> wrote:
>>>
>>>> Just to be sure: so, given the parameter specification
>>>>
>>>> required<deduced<tag::T>,F>,
>>>>
>>>> Boost.Parameter matches it to T<X> even if X does *not* satisfy
>>>> F, correct?
>>> That's the intention... although I can't promise SFINAE won't
>> kick in
>>> in some cases.
>> Joaquin was talking about class templates, so the above holds true.
>> SFINAE will kick in if you use the restriction mechanism for function
>> templates. The PP interface does that, so if you use that you can't
>> supply parameter types that doesn't match the predicate.
>
> I've read this over and over and can't say whether you're correcting
> Dave or me :( excuse my incompetence. So, given (in the context
> of class template parameters)
>
> required<deduced<tag::T>,F>,
>
> can Boost.Parameter match it to T<X> even if X does *not*
> satisfy F? Thank you!

Yes, that is correct. However, is you use `parameters::match<>` to
restrict a function template, SFINAE will kick in. For example:

  BOOST_PARAMETER_FUNCTION((void), f, tag,
    (deduced
      (required (x, (std::string)))
    )
  );

  f(x = 10); // no overload matches

-- 
Daniel Wallin
Boost Consulting
www.boost-consulting.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