mirror of
https://github.com/Jaxan/hybrid-ads.git
synced 2025-04-27 23:17:44 +02:00
Makes the project c++11, and removes some auto's
This commit is contained in:
parent
ac4139fc31
commit
d8f6399260
5 changed files with 8 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
||||||
project(Yannakakis)
|
project(Yannakakis)
|
||||||
cmake_minimum_required(VERSION 2.8)
|
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)
|
find_package(Boost REQUIRED COMPONENTS iostreams program_options filesystem system serialization)
|
||||||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
*/
|
*/
|
||||||
struct mealy {
|
struct mealy {
|
||||||
struct edge {
|
struct edge {
|
||||||
|
edge() = default;
|
||||||
|
edge(state t, output o) : to(t), output(o) {}
|
||||||
state to = state(-1);
|
state to = state(-1);
|
||||||
output output = size_t(-1);
|
output output = size_t(-1);
|
||||||
};
|
};
|
||||||
|
|
|
@ -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.size() < max_state) out.graph.resize(max_state);
|
||||||
if (out.graph[s2].size() < in.input_size) out.graph[s2].resize(in.input_size);
|
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);
|
if (!visited[t]) work.push(t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ mealy read_mealy_from_dot(std::istream & in, translation & t){
|
||||||
m.graph.resize(max_state);
|
m.graph.resize(max_state);
|
||||||
auto & v = m.graph[state_indices[lh]];
|
auto & v = m.graph[state_indices[lh]];
|
||||||
v.resize(t.max_input);
|
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;
|
m.graph_size = max_state;
|
||||||
|
|
|
@ -86,7 +86,7 @@ result create_splitting_tree(const mealy& g, options opt){
|
||||||
while(!work.empty()){
|
while(!work.empty()){
|
||||||
splitting_tree & boom = work.front();
|
splitting_tree & boom = work.front();
|
||||||
work.pop();
|
work.pop();
|
||||||
const auto depth = boom.depth;
|
const size_t depth = boom.depth;
|
||||||
|
|
||||||
if(boom.states.size() == 1) continue;
|
if(boom.states.size() == 1) continue;
|
||||||
|
|
||||||
|
@ -130,9 +130,9 @@ result create_splitting_tree(const mealy& g, options opt){
|
||||||
if(oboom.children.empty()) continue;
|
if(oboom.children.empty()) continue;
|
||||||
|
|
||||||
// possibly a succesful split, construct the children
|
// 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 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);
|
update_succession(state, ret.to, depth);
|
||||||
return ret.output;
|
return ret.output;
|
||||||
}, Q);
|
}, Q);
|
||||||
|
|
Loading…
Add table
Reference in a new issue