Erik Erlandson wrote:
I am grappling with how best to represent the returned "edit script".
the most generic way to return the edit script would be to template the algorithm on an output-handling class:
template
void diff(ITER1 begin1, ITER1 end1, ITER2 begin2, ITER2 end2, OUTPUT& output) I had a design using this approach, which has obvious advantages. The one thing I wasn't crazy about is that to do this, the implementation layer is committed to always computing and/or storing start+length information and edit-op cost information, so that the output handler has its space of choices about which information it cares about.
Not necessarily; you can allow a variety of methods in the output handler, with different names or signatures, and use "enable-if" SFINAE techniques to enable appropriate parts of the implementation algorithm. (I don't think I've ever seen anything like this done in a std:: or Boost library. Maybe someone else can think of concrete examples?) Regards, Phil.