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

Makes it c++11 again (only for main). Hopefully compiles on VS 2013 again.

This commit is contained in:
Joshua Moerman 2015-05-22 15:52:03 +02:00
parent da41dfec26
commit 00ad4445f3
6 changed files with 24 additions and 12 deletions

View file

@ -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})

View file

@ -43,7 +43,7 @@ separating_family create_separating_family(const adaptive_distinguishing_sequenc
states[s] = true; states[s] = true;
} }
const auto root const auto root
= lca(separating_sequences, [&states](auto z) -> bool { return states[z]; }); = lca(separating_sequences, [&states](state z) -> bool { return states[z]; });
vector<word> stack_of_words; vector<word> stack_of_words;
const function<void(splitting_tree const &)> recursor = [&](splitting_tree const & n) { const function<void(splitting_tree const &)> recursor = [&](splitting_tree const & n) {

View file

@ -82,7 +82,7 @@ template <typename T> struct trie {
/// \returns an array of words (without the prefixes) /// \returns an array of words (without the prefixes)
template <typename T> std::vector<std::vector<T>> flatten(trie<T> const & t) { template <typename T> std::vector<std::vector<T>> flatten(trie<T> const & t) {
std::vector<std::vector<T>> ret; std::vector<std::vector<T>> ret;
t.for_each([&ret](auto && w) { ret.push_back(w); }); t.for_each([&ret](std::vector<T> const & w) { ret.push_back(w); });
return ret; return ret;
} }
@ -90,7 +90,7 @@ template <typename T> std::vector<std::vector<T>> flatten(trie<T> const & t) {
template <typename T> std::pair<size_t, size_t> total_size(trie<T> const & t) { template <typename T> std::pair<size_t, size_t> total_size(trie<T> const & t) {
size_t count = 0; size_t count = 0;
size_t total_count = 0; size_t total_count = 0;
t.for_each([&count, &total_count](auto && w) { t.for_each([&count, &total_count](std::vector<T> const & w) {
++count; ++count;
total_count += w.size(); total_count += w.size();
}); });

View file

@ -3,6 +3,10 @@
#include <stddef.h> // for size_t #include <stddef.h> // for size_t
#include <vector> #include <vector>
#ifndef __APPLE__
using uint16_t = __int16;
#endif
// We use size_ts for fast indexing. Note that there is little type safety here // We use size_ts for fast indexing. Note that there is little type safety here
using state = uint16_t; using state = uint16_t;
using input = uint16_t; using input = uint16_t;

View file

@ -18,8 +18,13 @@ void print_vec(ostream & out, const vector<T> & x, const string & d, Fun && f) {
while (it != end(x)) out << d << f(*it++); while (it != end(x)) out << d << f(*it++);
} }
static const auto id = [](auto x) { return x; }; struct id_functor {
id_functor(){}
template <typename T>
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_) { void write_splitting_tree_to_dot(const splitting_tree & root, ostream & out_) {
write_tree_to_dot(root, [](const splitting_tree & node, 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; size_t overflows = 0;
write_tree_to_dot(root, [&symbols, &overflows](const adaptive_distinguishing_sequence & node, ostream & out) { write_tree_to_dot(root, [&symbols, &overflows](const adaptive_distinguishing_sequence & node, ostream & out) {
if (!node.word.empty()) { 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 { } else {
vector<state> I(node.CI.size()); vector<state> 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<state, state> p){ return p.second; });
if (I.size() < 7) { if (I.size() < 7) {
out << '{'; out << '{';
print_vec(out, I, ", ", id); print_vec(out, I, ", ", id);

View file

@ -3,8 +3,11 @@ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
file(GLOB sources "*.cpp") file(GLOB sources "*.cpp")
foreach(source ${sources}) #foreach(source ${sources})
get_filename_component(exec ${source} NAME_WE) # get_filename_component(exec ${source} NAME_WE)
add_executable(${exec} ${source}) # add_executable(${exec} ${source})
target_link_libraries(${exec} common ${libs}) # target_link_libraries(${exec} common ${libs})
endforeach() #endforeach()
add_executable(main main.cpp)
target_link_libraries(main common ${libs})