
"Reece Dunn" <msclrhd@hotmail.com> wrote
This was what I was thinking. But is there a way of handling the grammar template as a special case, e.g.:
template< typename T > class deduce_type { typedef ... type; };
template< typename DerivedT > class deduce_type< boost::spirit::grammar< DerivedT > > { typedef DerivedT::type type; };
I am not saying that this is what it will look like as I am not up to speed with your typeof mechanism, but if something similar could be implemented, it would make custom grammars more powerful (may even reduce the number of types that need explicit registration).
Hmmm, I am afraid this might not be possible... Once your DerivedT is present anywhere in the template tree, the typeof mechanism needs to know about it in order to be able to encode/decode it. This applies to any type or template. The library-defined types/templates can (and should) be registered by the library, but once a user defines a new type, it has to be registered too, by the user. Regards, Arkadiy