|
Boost : |
From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-07-12 14:50:58
"David Abrahams" <dave_at_[hidden]> wrote
> "Arkadiy Vertleyb" <vertleyb_at_[hidden]> writes:
> > Functions (as well as member functions and data members) are supported
by
> > the typeof library -- you don't need to register them. This comes from
the
> > fact that, for example, R(*)(T0, T1) can be applied to any function that
> > matches this signature, and only depends on R, T0, and T1.
> >
> > So, as long as you register MyType, the following, for example, will be
> > handled:
> >
> > int (MyType::*)(short&, const MyType&) const //FWIW
>
> It's clearly not a complete solution, then:
>
> template <int (*)()>
> struct f {};
>
> int g();
> int h();
>
> BOOST_STATIC_ASSERT((!boost::is_same<typeof(f<&g>()),typeof(f<&h>())));
>
> That's all I meant about registering functions.
Sorry, I misunderstood this. I don't have direct support for function
pointer template parameters. As well as I don't have direct support for
integral template parameters in general. It just would be infeasible for me
to define all possible generic combinations, like:
template<class, class, class> class foo1{};
template<class, int, int> class foo2{};
template<class, bool, int(*)()> class foo3{};
etc.
Specialisations for these kind of templates need to be provided by hand.
Or, better yet, such template parameters could be wrapped into mpl::int_,
mpl::bool_, etc. I don't know if there is anything like this for a function
pointer, but it definitely can be provided...
Arkadiy
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk