1
Fork 0
mirror of https://github.com/Jaxan/hybrid-ads.git synced 2025-04-27 15:07:45 +02:00

Makes the project c++11, and removes some auto's

This commit is contained in:
Joshua Moerman 2015-04-08 10:43:04 +02:00
parent ac4139fc31
commit d8f6399260
5 changed files with 8 additions and 6 deletions

View file

@ -1,7 +1,7 @@
project(Yannakakis)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(Boost REQUIRED COMPONENTS iostreams program_options filesystem system serialization)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})

View file

@ -17,6 +17,8 @@
*/
struct mealy {
struct edge {
edge() = default;
edge(state t, output o) : to(t), output(o) {}
state to = state(-1);
output output = size_t(-1);
};

View file

@ -37,7 +37,7 @@ mealy reachable_submachine(const mealy& in, state start) {
if (out.graph.size() < max_state) out.graph.resize(max_state);
if (out.graph[s2].size() < in.input_size) out.graph[s2].resize(in.input_size);
out.graph[s2][i] = {t2, o};
out.graph[s2][i] = mealy::edge(t2, o);
if (!visited[t]) work.push(t);
}

View file

@ -57,7 +57,7 @@ mealy read_mealy_from_dot(std::istream & in, translation & t){
m.graph.resize(max_state);
auto & v = m.graph[state_indices[lh]];
v.resize(t.max_input);
v[t.input_indices[input]] = {state_indices[rh], t.output_indices[output]};
v[t.input_indices[input]] = mealy::edge(state_indices[rh], t.output_indices[output]);
}
m.graph_size = max_state;

View file

@ -86,7 +86,7 @@ result create_splitting_tree(const mealy& g, options opt){
while(!work.empty()){
splitting_tree & boom = work.front();
work.pop();
const auto depth = boom.depth;
const size_t depth = boom.depth;
if(boom.states.size() == 1) continue;
@ -130,9 +130,9 @@ result create_splitting_tree(const mealy& g, options opt){
if(oboom.children.empty()) continue;
// possibly a succesful split, construct the children
const auto word = concat({symbol}, oboom.seperator);
const vector<input> word = concat(vector<input>(1, symbol), oboom.seperator);
const auto new_blocks = partition_(begin(boom.states), end(boom.states), [word, depth, &g, &update_succession](state state){
const auto ret = apply(g, state, begin(word), end(word));
const mealy::edge ret = apply(g, state, word.begin(), word.end());
update_succession(state, ret.to, depth);
return ret.output;
}, Q);