accel_dfa_build_strat: use small_vector for paths

This commit is contained in:
Justin Viiret
2017-04-10 11:05:06 +10:00
committed by Matthew Barr
parent 304bac3286
commit c9be18c7e2
3 changed files with 25 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2016, Intel Corporation
* Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -249,15 +249,6 @@ string describeClass(const CharReach &cr, size_t maxLength,
return oss.str();
}
string describeClasses(const std::vector<CharReach> &v, size_t maxClassLength,
enum cc_output_t out_type) {
std::ostringstream oss;
for (const auto &cr : v) {
describeClass(oss, cr, maxClassLength, out_type);
}
return oss.str();
}
// C stdio wrapper
void describeClass(FILE *f, const CharReach &cr, size_t maxLength,
enum cc_output_t out_type) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2016, Intel Corporation
* Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -37,6 +37,7 @@
#include <cstdio>
#include <ostream>
#include <sstream>
#include <string>
#include <vector>
@@ -55,9 +56,16 @@ void describeClass(std::ostream &os, const CharReach &cr, size_t maxLength = 16,
std::string describeClass(const CharReach &cr, size_t maxLength = 16,
enum cc_output_t out_type = CC_OUT_TEXT);
std::string describeClasses(const std::vector<CharReach> &v,
template<typename Container>
std::string describeClasses(const Container &container,
size_t maxClassLength = 16,
enum cc_output_t out_type = CC_OUT_TEXT);
enum cc_output_t out_type = CC_OUT_TEXT) {
std::ostringstream oss;
for (const CharReach &cr : container) {
describeClass(oss, cr, maxClassLength, out_type);
}
return oss.str();
}
void describeClass(FILE *f, const CharReach &cr, size_t maxLength,
enum cc_output_t out_type);