NeuralEngine A Game Engine with embeded Machine Learning algorithms based on Gaussian Processes. |

NeReversalObject.h
1
11#pragma once
12
13#include <NeCoreLib.h>
14#include <iterator>
15#include <type_traits>
16
17// For information on range-based for-loops, see
18// http://en.cppreference.com/w/cpp/language/range-for
19
20 namespace NeuralEngine
21{
22
23 template <typename Iterator>
24
50 class ReversalObject
51 {
52 public:
53 ReversalObject(Iterator begin, Iterator end)
54 :
55 mBegin(begin),
56 mEnd(end)
57 {
58 }
59
60 Iterator begin() const { return mBegin; }
61 Iterator end() const { return mEnd; }
62
63 private:
64 Iterator mBegin, mEnd;
65 };
66
67 template
68 <
69 typename Iterable,
70 typename Iterator = decltype(std::begin(std::declval<Iterable>())),
71 typename ReverseIterator = std::reverse_iterator<Iterator>
72 >
73 ReversalObject<ReverseIterator> reverse(Iterable&& range)
74 {
75 return ReversalObject<ReverseIterator>(
76 ReverseIterator(std::end(range)),
77 ReverseIterator(std::begin(range)));
78 }
79
80}
NeuralEngine::ReversalObject
Reversal object.
Definition: NeReversalObject.h:51
NeuralEngine
Definition: NeArray2.h:18