Boost logo

Boost :

Subject: Re: [boost] RFC: edit_distance / edit_alignment library
From: Erik Erlandson (eje_at_[hidden])
Date: 2013-07-24 13:19:33


----- Original Message -----
> 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 <typename ITER1, typename ITER2, typename OUTPUT>
> >> 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.

True, it might be possible to apply Clever MPL Tricks, maybe involving boost::function_types, to allow smart template specializations from an output-class method. Considering how the Meyers and SSSP algorithms work, I'm now feeling less sure about how much it even matters. Good fodder for next round of tinkering.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk