On 8/23/2014 8:30 AM, Niall Douglas wrote:
On 22 Aug 2014 at 17:00, Edward Diener wrote:
But here is a possible example, although purely theoretical as to its use. Suppose you designed a macro where you were creating a C++ class. In the macro you might have some input parameter which, if the user specified the identifier 'public' the code you were creating from further macro input would go in a base class, if the user specified the identifier "protected' the code you were creating from further macro input would go in a derived class, and if the user specified 'private' the code you were creating from further macro input would go in a pimpl class connected to the base class by a pimpl sort of identifier. VMD has the ability to test for specific identifiers, such as 'public', 'protected', 'private', and based on the test you could use the Boost PP macro 'BOOST_PP_IIF' to create the output you needed.
Are you saying here that one can use macros to do static reflection of the member access attributes of member functions, or that one can use macros to synthesise the member access attributes of member functions?
Neither. The TTI library uses macros to pass the name of the inner element to be introspected. It then creates metafunctions to do the introspecting using that name. It also uses macros in other ways. I strongly suggest, instead of taking a stance that macro metaprogramming should be obsoleted and is therefore not important to you, that you look at Boost PP in order to understand what it is about. Then you might understand better what I am doing in the VMD library. It is not an effort to solve some specific problem. It is an effort to add facilities to do macro metaprogramming which have a different focus than Boost PP.
If the former that is something we cannot do in C++ 14 without extra manually inserted metadata. If the latter then it is something we can easily do in C++ 98 via policy inheritance, let alone C++ 14.