
El 08/07/2011 12:17, John M. Dlugosz escribió:
I roughed out a function that will be a template that dispatches to one of several different forms based on the nature of one of the arguments. It's fairly simple, each helper call asking one question to further divide it up.
But, I want to write a dozen functions that all have similar (if not identical) issues. So I want to abstract out the mixmaster and code that once. I'm thinking that I map the argument to a "tag" that has many possible values, and have one set of overloaded functions. It is easy to write the back end, as each function's tag is clear what that case is for. Furthermore, I can make the tags empty structs that use an inheritance pattern, so any forms I don't supply for some function will simply pick the more general one.
So, how do I write the metafunction that maps the type to the tag?
Using a boost::mpl::map? http://www.boost.org/libs/mpl/doc/refmanual/map.html Joaquín M López Muñoz Telefónica, Investigación y Desarrollo Este mensaje se dirige exclusivamente a su destinatario. Puede consultar nuestra política de envío y recepción de correo electrónico en el enlace situado más abajo. This message is intended exclusively for its addressee. We only send and receive email on the basis of the terms set out at. http://www.tid.es/ES/PAGINAS/disclaimer.aspx