Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | pmbaty | 1 | /* |
| 2 | * This file is part of the DXX-Rebirth project <https://www.dxx-rebirth.com/>. |
||
| 3 | * It is copyright by its individual contributors, as recorded in the |
||
| 4 | * project's Git history. See COPYING.txt at the top level for license |
||
| 5 | * terms and a link to the Git history. |
||
| 6 | */ |
||
| 7 | #pragma once |
||
| 8 | |||
| 9 | template <typename T, typename iterator> |
||
| 10 | struct reverse_traversal_t |
||
| 11 | { |
||
| 12 | typedef typename T::const_reverse_iterator const_iterator; |
||
| 13 | T *container; |
||
| 14 | reverse_traversal_t(T *c) : container(c) {} |
||
| 15 | iterator begin() const { return container->rbegin(); } |
||
| 16 | iterator end() const { return container->rend(); } |
||
| 17 | }; |
||
| 18 | |||
| 19 | template <typename T> |
||
| 20 | static inline reverse_traversal_t<T, typename T::reverse_iterator> reverse_traversal(T &c) |
||
| 21 | { |
||
| 22 | return &c; |
||
| 23 | } |
||
| 24 | |||
| 25 | template <typename T> |
||
| 26 | static inline reverse_traversal_t<const T, typename T::const_reverse_iterator> reverse_traversal(const T &c) |
||
| 27 | { |
||
| 28 | return &c; |
||
| 29 | } |