Boost logo

Boost Users :

Subject: Re: [Boost-users] compile-time check that a member function exists
From: Igor R (boost.lists_at_[hidden])
Date: 2009-03-25 11:38:14

2008/7/23 joel falcou <joel.falcou_at_[hidden]>:
> Le Mar 22 juillet 2008 22:38, John Pretz a écrit :
>> Thank you very much. That worked great.
> It's pretty rough and need to be "standardized" so it actually acts properly
> as a MPL bool and make it parametrable on the name of the member. I think a
> macro using BOOST_TYPEOF to get the type of the function pointer from its
> name should be doable.

Could you please elaborate a bit more?

I'd like to apply the above test to something like this:

template<class Impl> struct my_class
  bool f1()
    return f1_impl(has_mem_fun_f1<Impl>::type);
  bool f2()...
  bool f3()...
  bool f1_impl(mpl::bool_<true>)
    return impl_.f1();
  bool f1_impl(mpl::bool_<false>)
    return false;
  Impl impl_;

In other words, in this class I want to "convert" static restrictions
to dynamic ones, i.e. to return false whenever the interface function
is not defined in the implementation.
So is it possible to parametrize the above test on the mem.func. name?


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at