Horizon
list_accumulator.hpp
1 #pragma once
2 #include <list>
3 
4 namespace horizon {
5 template <class Ret, bool back> struct list_accumulator {
6  typedef std::list<Ret> result_type;
7  template <typename T_iterator> result_type operator()(T_iterator first, T_iterator last) const
8  {
9  result_type lst;
10  for (; first != last; ++first) {
11  if (back)
12  lst.push_back(*first);
13  else
14  lst.push_front(*first);
15  }
16  return lst;
17  }
18 };
19 
20 } // namespace horizon
Definition: list_accumulator.hpp:5