Subject: Re: [boost] Is there interest in a library for testing existence of a function member of class?
From: Adam Merz (adammerz_at_[hidden])
Date: 2014-11-23 06:12:23
Phil Endecott <spam_from_boost_dev <at> chezphil.org> writes:
> 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?
In C++11, decltype and expression SFINAE make this trait very trivial. (decltype
is enough to not need the signature.)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk