Boost logo

Boost Users :

Subject: Re: [Boost-users] [FunctionTypes] Testing for a general callable type.
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2013-04-23 09:45:14


On 25 March 2013 20:48, Jeffrey Lee Hellrung, Jr. <
jeffrey.hellrung_at_[hidden]> wrote:

>
> That's because the type of DefaultVal is void ( int ). Function types
> cannot encode the default'ness of parameters.
>
>
How about this example? This fails to compile for me, with a template
instantiation ambiguity. Any thoughts?

Thx, Rob.

#include "boost/type_traits/has_call.hpp"
#include <cassert>

template<typename Sig, typename F>
bool HasCall(F const&)
{ return boost::has_call<F, Sig>::value; }

void DefaultVal(int) {}

int main()
{
    assert(HasCall<boost::dont_care(int)>(DefaultVal));
}

-- 
ACCU - Professionalism in programming - http://www.accu.org


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