Boost logo

Proto :

Subject: Re: [proto] Matching terminals holding a function pointer
From: Eric Niebler (eric_at_[hidden])
Date: 2011-02-07 21:56:10


On 2/8/2011 3:38 AM, Bart Janssens wrote:
> Hi,
>
> I may be overlooking the obvious here, but I can't seem to find an
> easy way to match terminals containing a pointer to a function (of
> arbitrary type).
<snip>

Sure there's an easy way. You can use proto::if_ and type traits:

// untested
struct FunctionPointer
  : proto::and_<
        proto::terminal< _ >
      , proto::if_< is_pointer< proto::_value >() >
      , proto::if_< is_function<
            remove_pointer< proto::_value > >() >
>
{};

HTH,

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Proto list run by eric at boostpro.com