Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-07-12 14:08:25


"Arkadiy Vertleyb" <vertleyb_at_[hidden]> writes:

> "David Abrahams" <dave_at_[hidden]> wrote
>
>> I'm don't see why you'd need to register operators. If I'm not
>> mistaken, with Arkadiy's solution you only need to register
>> user-defined types and templates (and maybe functions if they are used
>> as template arguments).
>
> 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.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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