Boost logo

Boost :

Subject: Re: [boost] RFC: edit_distance / edit_alignment library
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2013-07-24 12:54:47


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.

(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.


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