Allow saving SES to provided data storage

It is not always efficient (or possible) to use standard output
streams. Moreover, such generated result may be now further
processed.
This commit is contained in:
Wiktor Lawski
2020-09-12 19:50:31 +02:00
parent 6b030d6397
commit ca3fa6846a
4 changed files with 88 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
#include <dtl/dtl.hpp>
#include "common.hpp"
#include <iostream>
#include <string>
#include "storage.hpp"
using namespace std;
using dtl::Diff;
int main(int argc, char *argv[]){
if (isFewArgs(argc)) {
cerr << "Too few arguments." << endl;
return -1;
}
typedef char elem;
typedef string sequence;
sequence A(argv[1]);
sequence B(argv[2]);
Diff< elem, sequence > d(A, B);
d.compose();
// Shortest Edit Script
cout << "SES" << endl;
string result;
d.storeSES < string, CustomStorage > (result);
cout << result;
return 0;
}