From 71f15e988b7247f19e4c0a99516e2e9ac218f1e5 Mon Sep 17 00:00:00 2001 From: Jakob Truelsen Date: Sat, 8 Dec 2018 22:20:22 +0100 Subject: [PATCH] Use constructed_type instead of constructed::type and used std::less in sorters. Fix #232 and #231 --- tpie/pipelining/factory_helpers.h | 49 +++++------ tpie/pipelining/pair_factory.h | 16 ++-- tpie/pipelining/parallel/base.h | 4 +- tpie/pipelining/parallel/factory.h | 12 +-- tpie/pipelining/pipe_base.h | 10 ++- tpie/pipelining/serialization_sort.h | 79 +++--------------- tpie/pipelining/sort.h | 116 +++++---------------------- tpie/pipelining/virtual.h | 18 ++--- 8 files changed, 79 insertions(+), 225 deletions(-) diff --git a/tpie/pipelining/factory_helpers.h b/tpie/pipelining/factory_helpers.h index cfe1974e1..8022dc307 100644 --- a/tpie/pipelining/factory_helpers.h +++ b/tpie/pipelining/factory_helpers.h @@ -42,15 +42,13 @@ class factory : public factory_base { template factory(Args && ... v) : cont(std::forward(v)...) {} - template - struct constructed { - typedef R::type> type; - }; + template + using constructed_type = R::type>; template - typename constructed::type construct(dest_t && dest) { + constructed_type construct(dest_t && dest) { node_token tok = dest.get_token(); - typename constructed::type r = container_construct::type>(cont, std::forward(dest)); + constructed_type r = container_construct>(cont, std::forward(dest)); this->init_node(r); this->add_default_edge(r, tok); this->add_node_set_edges(r); @@ -58,9 +56,9 @@ class factory : public factory_base { } template - typename constructed::type construct_copy(dest_t && dest) { + constructed_type construct_copy(dest_t && dest) { node_token tok = dest.get_token(); - typename constructed::type r = container_construct_copy::type>(cont, std::forward(dest)); + constructed_type r = container_construct_copy>(cont, std::forward(dest)); this->init_node(r); this->add_default_edge(r, tok); this->add_node_set_edges(r); @@ -86,15 +84,13 @@ class tempfactory : public factory_base { template tempfactory(Args && ... v) : cont(std::forward(v)...) {} - template - struct constructed { - typedef typename Holder::template type::type> type; - }; + template + using constructed_type = typename Holder::template type::type>; template - typename constructed::type construct(dest_t && dest) { + constructed_type construct(dest_t && dest) { node_token tok = dest.get_token(); - typename constructed::type r = container_construct::type>(cont, std::forward(dest)); + constructed_type r = container_construct>(cont, std::forward(dest)); this->init_node(r); this->add_default_edge(r, tok); this->add_node_set_edges(r); @@ -102,9 +98,9 @@ class tempfactory : public factory_base { } template - typename constructed::type construct_copy(dest_t && dest) { + constructed_type construct_copy(dest_t && dest) { node_token tok = dest.get_token(); - typename constructed::type r = container_construct_copy::type>(cont, std::forward(dest)); + constructed_type r = container_construct_copy>(cont, std::forward(dest)); this->init_node(r); this->add_default_edge(r, tok); this->add_node_set_edges(r); @@ -172,14 +168,12 @@ class tfactory, T...> : public factory_base { tfactory(Args && ... v) : cont(std::forward(v)...) {} template - struct constructed { - typedef R::type, TT...> type; - }; + using constructed_type = R::type, TT...>; template - typename constructed::type construct(dest_t && dest) { + constructed_type construct(dest_t && dest) { node_token tok = dest.get_token(); - typename constructed::type r = container_construct::type>(cont, std::forward(dest)); + constructed_type r = container_construct>(cont, std::forward(dest)); this->init_node(r); this->add_default_edge(r, tok); this->add_node_set_edges(r); @@ -187,9 +181,9 @@ class tfactory, T...> : public factory_base { } template - typename constructed::type construct_copy(dest_t && dest) { + constructed_type construct_copy(dest_t && dest) { node_token tok = dest.get_token(); - typename constructed::type r = container_construct_copy::type>(cont, std::forward(dest)); + constructed_type r = container_construct_copy>(cont, std::forward(dest)); this->init_node(r); this->add_default_edge(r, tok); this->add_node_set_edges(r); @@ -212,13 +206,10 @@ template