Boost logo

Boost :

Subject: Re: [boost] [functional] Interested in can_be_called<F, Sig> metafunction?
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-11-06 09:17:58


On Tue, Nov 6, 2012 at 12:22 AM, TONGARI <tongari95_at_[hidden]> wrote:

> 2012/11/6 Eric Niebler <eric_at_[hidden]>
>
> > On 11/5/2012 9:12 PM, TONGARI wrote:
> > > 2012/11/6 Eric Niebler <eric_at_[hidden]>
> > >> On 11/4/2012 5:15 AM, TONGARI wrote:
> > >>> Hi there,
> > >>>
> > >>> I've used this metafunction for some time, and it just fitted my
> need.
> > >>> Recently, I make up my mind to complete it, willing to put it in
> > public.
> > >>>
> > >>> Synopsis
> > >>> --------------
> > >>> can_be_called<F, Sig>
> > >>>
> > >>> F
> > >>> Any callable type to test, even member-function ptr.
> > >>> Sig
> > >>> The desired calling signature, function-type only.
> > >>
> > >> There is a feature request for this already in Trac, with source code
> > >> attached.
> > >>
> > >> https://svn.boost.org/trac/boost/ticket/3783
> > >>
> > >> Sadly, it was opened 3 years ago.
> > >
> > > Surely I'm aware of this, but I don't think it'd work out-of-box, would
> > it?
> >
> > What do you mean? If you mean that the attached code needs polish, I
> > guess you're probably right, but it's been 3 years since I wrote it. :-)
> >
>
> That was my first try that doesn't compile, but it's due to the disability
> in file iteration for local include path on the compiler I used, but it's
> easy to fix anyway.
>
> And some misreading in your code gave me the impression that it won't work
> properly, but surely it does work :-)
>
> Regarding the difference, mine also concerns the return type (it's useful
> in my case) and capable of member-function ptr (not sure it's useful or
> not) and may work for some contrived cases...
>
>
> > If your code is polished, has docs, and tests, then maybe you can attach
> > it to the ticket and ping Tobias. If he doesn't respond, then I guess
> > Function_types is looking for a new maintainer, and you could be it.
> >
>
> But I don't want it in FunctionTypes, Functional seems a better place to me
> and could just become Functional/Can Be Called as other Functional/XXX.
>

Wouldn't this fit in Boost.TypeTraits, along side the other type traits
that introspect operators?

- Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk