diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e55e10..18fd895 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/lib/separating_family.cpp b/lib/separating_family.cpp index fd69dbf..9ae22e7 100644 --- a/lib/separating_family.cpp +++ b/lib/separating_family.cpp @@ -43,7 +43,7 @@ separating_family create_separating_family(const adaptive_distinguishing_sequenc states[s] = true; } const auto root - = lca(separating_sequences, [&states](auto z) -> bool { return states[z]; }); + = lca(separating_sequences, [&states](state z) -> bool { return states[z]; }); vector stack_of_words; const function recursor = [&](splitting_tree const & n) { diff --git a/lib/trie.hpp b/lib/trie.hpp index 6f30c11..2310811 100644 --- a/lib/trie.hpp +++ b/lib/trie.hpp @@ -82,7 +82,7 @@ template struct trie { /// \returns an array of words (without the prefixes) template std::vector> flatten(trie const & t) { std::vector> ret; - t.for_each([&ret](auto && w) { ret.push_back(w); }); + t.for_each([&ret](std::vector const & w) { ret.push_back(w); }); return ret; } @@ -90,7 +90,7 @@ template std::vector> flatten(trie const & t) { template std::pair total_size(trie const & t) { size_t count = 0; size_t total_count = 0; - t.for_each([&count, &total_count](auto && w) { + t.for_each([&count, &total_count](std::vector const & w) { ++count; total_count += w.size(); }); diff --git a/lib/types.hpp b/lib/types.hpp index 8aa4969..f268123 100644 --- a/lib/types.hpp +++ b/lib/types.hpp @@ -3,6 +3,10 @@ #include // for size_t #include +#ifndef __APPLE__ +using uint16_t = __int16; +#endif + // We use size_ts for fast indexing. Note that there is little type safety here using state = uint16_t; using input = uint16_t; diff --git a/lib/write_tree_to_dot.cpp b/lib/write_tree_to_dot.cpp index cc8f3a1..f26baa7 100644 --- a/lib/write_tree_to_dot.cpp +++ b/lib/write_tree_to_dot.cpp @@ -18,8 +18,13 @@ void print_vec(ostream & out, const vector & x, const string & d, Fun && f) { while (it != end(x)) out << d << f(*it++); } -static const auto id = [](auto x) { return x; }; +struct id_functor { + id_functor(){} + template + T operator()(T const & x) const { return x; } +}; +static const id_functor id; void write_splitting_tree_to_dot(const splitting_tree & root, ostream & out_) { write_tree_to_dot(root, [](const splitting_tree & node, ostream & out) { @@ -42,10 +47,10 @@ void write_adaptive_distinguishing_sequence_to_dot(const adaptive_distinguishing size_t overflows = 0; write_tree_to_dot(root, [&symbols, &overflows](const adaptive_distinguishing_sequence & node, ostream & out) { if (!node.word.empty()) { - print_vec(out, node.word, " ", [&symbols](auto x){ return "I" + symbols[x]; }); + print_vec(out, node.word, " ", [&symbols](input x){ return "I" + symbols[x]; }); } else { vector I(node.CI.size()); - transform(begin(node.CI), end(node.CI), begin(I), [](auto p){ return p.second; }); + transform(begin(node.CI), end(node.CI), begin(I), [](pair p){ return p.second; }); if (I.size() < 7) { out << '{'; print_vec(out, I, ", ", id); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f5a146a..8e6c5f2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,8 +3,11 @@ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) file(GLOB sources "*.cpp") -foreach(source ${sources}) - get_filename_component(exec ${source} NAME_WE) - add_executable(${exec} ${source}) - target_link_libraries(${exec} common ${libs}) -endforeach() +#foreach(source ${sources}) +# get_filename_component(exec ${source} NAME_WE) +# add_executable(${exec} ${source}) +# target_link_libraries(${exec} common ${libs}) +#endforeach() + +add_executable(main main.cpp) +target_link_libraries(main common ${libs})