molpopgen / fwdpp

fwdpp is a C++ template library for implementing efficient forward-time population genetic simulations
http://fwdpp.readthedocs.io
GNU General Public License v3.0
27 stars 11 forks source link

Mutation types should supply functions to generate new objects #73

Closed molpopgen closed 6 years ago

molpopgen commented 6 years ago

Types like KTfwd::infsites (fwdpp/sugar/infsites.hpp) and KTfwd::discrete_mut_model (fwdpp/extensions/regions.hpp) are not easily extensible. The current API relies too much on SFINAE ideas and also has too much code repetition (discrete_mut_model replicates a lot of code in infsites, for example).

It would be preferable if mutation types had static member functions returning new objects. Implementing this would enforce API standards for new types and provided avenues for code reuse and better extensibility.

molpopgen commented 6 years ago

The proposed changes in #100 suggest that infsites should be a generic wrapper enabling some type erasure. To avoid the use of std::bind, we should provide a bind_infsites template function returning a lambda.