Boost logo

Boost :

Subject: Re: [boost] Is there interest in a library for testing existence of a function member of class?
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2014-11-22 12:58:09

TONGARI J wrote:
> 2014-11-22 17:36 GMT+08:00 ?? <huwei04_at_[hidden]>:
>> Hi,
>> I am looking for how to test if a function member of class exist or not in
>> compile time.I did not find a solution by google so I wrote a piece of code
>> for it.Please let me know if it's already in boost. :)
> Yes, it's in Boost.TTI:

Has anyone ever worked out how to do this without having to specify
the type? E.g. with BOOST_TTI_HAS_MEMBER_DATA I need to write
something like

     has_member_data_fieldname<int ClasdName::*>::value;

The most recent time I needed something like this, I wanted to test
whether a struct contained a field with a particular name that was
convertible to a float (I think float or int16_t in that case).
I would have been happy with a test for a field with that name of
any type. But I couldn't work out how to do it. Any ideas?

Regards, Phil.

Boost list run by bdawes at, gregod at, cpdaniel at, john at