From bb57e1883b81c3c7bed9afbfc3e94a7974aa5175 Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Thu, 3 Mar 2016 11:41:08 -0500 Subject: [PATCH] Do not required C++14. --- include/deal.II/grid/filtered_iterator.h | 56 +++++++++++++++++++----- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/include/deal.II/grid/filtered_iterator.h b/include/deal.II/grid/filtered_iterator.h index 82344cebca..59fa12fb83 100644 --- a/include/deal.II/grid/filtered_iterator.h +++ b/include/deal.II/grid/filtered_iterator.h @@ -23,6 +23,9 @@ #include #include +#ifdef DEAL_II_WITH_CXX11 +#include +#endif DEAL_II_NAMESPACE_OPEN @@ -773,8 +776,37 @@ make_filtered_iterator (const BaseIterator &i, #ifdef DEAL_II_WITH_CXX11 +namespace internal +{ + namespace FilteredIterator + { + // The following classes create a nested sequencee of + // FilteredIterator...>> with as many + // levels of FilteredIterator classes as there are elements in the TypeList + // if the latter is given as a std::tuple. + template + struct NestFilteredIterators; + + template + struct NestFilteredIterators > + { + typedef ::dealii::FilteredIterator type; + }; + + template + struct NestFilteredIterators > + { + typedef ::dealii::FilteredIterator >::type> type; + }; + } +} + + + /** - * Filter the given range of iterators using a Predicate. This allows to replace: + * Filter the given range of iterators using a Predicate. This allows to + * replace: * @code * DoFHandler dof_handler; * ... @@ -799,8 +831,8 @@ make_filtered_iterator (const BaseIterator &i, * } * @endcode * - * @author Bruno Turcksin - * @relates FilteredIterator + * @author Bruno Turcksin, 2016 + * @relates FilteredIterator * @ingroup CPP11 */ template @@ -813,14 +845,12 @@ filter_iterators (IteratorRange i, return IteratorRange > (fi, fi_end); } -#endif -#ifdef DEAL_II_WITH_CXX14 /** - * Filter the given of iterators an arbitrary number of Predicates. This allows - * to replace: + * Filter the given range of iterators through an arbitrary number of + * Predicates. This allows to replace: * @code * DoFHandler dof_handler; * ... @@ -849,16 +879,18 @@ filter_iterators (IteratorRange i, * } * @endcode * - * @note This function requires C++14 - * - * @author Bruno Turcksin + * @author Bruno Turcksin, 2016 * @relates FilteredIterator + * @ingroup CPP11 */ template -auto +IteratorRange >::type> filter_iterators (IteratorRange i, - const Predicate &p, const Targs... args) + const Predicate &p, + const Targs... args) { + // Recursively create filtered iterators, one predicate at a time auto fi = filter_iterators(i,p); return filter_iterators(fi, args...); } -- 2.39.5