
"Joel de Guzman" <joel@boost-consulting.com> wrote
Arkadiy Vertleyb wrote:
Hi All,
Do you think it makes sense to write a utility that, using a syntax like following:
template<class T, class U> class foo /*typeof*/ { . . . };
struct bar /*typeof*/ { . . . };
// etc.
would generate the typeof registrations? I think it could be quite helpful to those library authors who want to make their libs typeof-enabled, since it would minimise the duplication issue...
This utility could be written using Spirit or maybe Python or any other suitable tool.
YES!!!
I played with this a bit (using Spirit), and the most challenging part seems to be parsing the default parameters, which can be complicated expressions, for example: template<class T, int n = traits<T*>::size + 1> class x{}; I don't actually need to parse it, just to skip till the next comma or angle bracket (considering nesting). What would be the easiest way to accomplish this? A custom parser? Also, maybe I am re-inventing the wheel -- are there any Spirit parsers to assist in working with the C++ grammar? Regards, Arkadiy