diff --git a/tpie/CMakeLists.txt b/tpie/CMakeLists.txt
index 509e27202..9b6c79344 100644
--- a/tpie/CMakeLists.txt
+++ b/tpie/CMakeLists.txt
@@ -71,6 +71,7 @@ set (HEADERS
pipelining/factory_helpers.h
pipelining/file_stream.h
pipelining/filter.h
+ pipelining/filter_map.h
pipelining/forwarder.h
pipelining/helpers.h
pipelining/internal_buffer.h
diff --git a/tpie/pipelining/filter_map.h b/tpie/pipelining/filter_map.h
new file mode 100644
index 000000000..e069622e7
--- /dev/null
+++ b/tpie/pipelining/filter_map.h
@@ -0,0 +1,71 @@
+// -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*-
+// vi:set ts=4 sts=4 sw=4 noet :
+// Copyright 2015 The TPIE development team
+//
+// This file is part of TPIE.
+//
+// TPIE is free software: you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the
+// Free Software Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// TPIE is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with TPIE. If not, see
+
+#ifndef __TPIE_PIPELINING_FILTER_H__
+#define __TPIE_PIPELINING_FILTER_H__
+
+#include
+#include
+#include
+#include
+#include
+
+namespace tpie::pipelining {
+namespace bits {
+
+template
+class filter_map_t: public node {
+private:
+ F functor;
+ dest_t dest;
+
+public:
+ typedef typename std::decay::argument_type>::type item_type;
+ typedef typename push_type::type item_type;
+
+ filter_map_t(dest_t dest, const F & functor):
+ functor(functor), dest(std::move(dest)) {
+ set_name(bits::extract_pipe_name(typeid(F).name()), PRIORITY_NO_NAME);
+ }
+
+ void push(const item_type & item) {
+ typename F::result_type t=f(item);
+ if (t.second) dest.push(t.first);
+ }
+};
+
+} //namespace bits
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief A pipelining node that applies a functor to items and only keeps
+/// some of them based on the functor's result.
+/// \details The result of the functor must be a pair, e.g.
+/// std::pair: the second item is a boolean indiciating whether
+/// item should be pushed to the next node while the first one carries the value
+/// itself that is to be pushed.
+/// \param functor The functor that should be applied to items
+///////////////////////////////////////////////////////////////////////////////
+template ::value>::type>
+pipe_middle, F> > filter_map(const F & functor) {
+ return {functor};
+}
+
+} //namespace terrastream::pipelining
+
+#endif //__TPIE_PIPELINING_FILTER_H__
diff --git a/tpie/pipelining/std_glue.h b/tpie/pipelining/std_glue.h
index ef87b98d1..b1a9ee207 100644
--- a/tpie/pipelining/std_glue.h
+++ b/tpie/pipelining/std_glue.h
@@ -26,6 +26,7 @@
#include
#include
#include
+#include
namespace tpie::pipelining {
namespace bits {
@@ -101,21 +102,7 @@ template
using lambda_t [[deprecated("Use 'map_t' in 'tpie/pipelining/map.h'.")]] = map_t;
template
-class exclude_lambda_t: public node {
-public:
- typedef typename F::argument_type item_type;
-
- exclude_lambda_t(dest_t dest, const F & f): f(f), dest(std::move(dest)) { }
-
- void push(const item_type & item) {
- typename F::result_type t=f(item);
- if (t.second) dest.push(t.first);
- }
-private:
- F f;
- dest_t dest;
-};
-
+using exclude_lambda_t [[deprecated("Use 'filter_map_t' in 'tpie/pipelining/map.h'.")]] = filter_map_t;
} // namespace bits
@@ -176,6 +163,7 @@ inline pipe_middle, F> > lambda(const F & f) {
/// \param f The functor that should be applied to items
///////////////////////////////////////////////////////////////////////////////
template
+[[deprecated("Use 'filter_map' in 'tpie/pipelining/filter_map.h'.")]]
inline pipe_middle, F> > exclude_lambda(const F & f) {
return {f};
}