9 #ifndef CUBBYFLOW_SERIAL_IMPL_H 10 #define CUBBYFLOW_SERIAL_IMPL_H 16 template <
typename RandomIterator,
typename T>
17 void SerialFill(
const RandomIterator& begin,
const RandomIterator& end,
const T& value)
19 size_t size =
static_cast<size_t>(end - begin);
21 SerialFor(
size_t(0), size, [begin, value](
size_t i)
27 template <
typename IndexType,
typename Function>
28 void SerialFor(IndexType beginIndex, IndexType endIndex,
const Function&
function)
30 for (IndexType i = beginIndex; i < endIndex; ++i)
36 template <
typename IndexType,
typename Function>
38 IndexType beginIndexX, IndexType endIndexX,
39 IndexType beginIndexY, IndexType endIndexY,
40 const Function&
function)
42 for (IndexType j = beginIndexY; j < endIndexY; ++j)
44 for (IndexType i = beginIndexX; i < endIndexX; ++i)
51 template <
typename IndexType,
typename Function>
53 IndexType beginIndexX, IndexType endIndexX,
54 IndexType beginIndexY, IndexType endIndexY,
55 IndexType beginIndexZ, IndexType endIndexZ,
56 const Function&
function)
58 for (IndexType k = beginIndexZ; k < endIndexZ; ++k)
60 for (IndexType j = beginIndexY; j < endIndexY; ++j)
62 for (IndexType i = beginIndexX; i < endIndexX; ++i)
70 template<
typename RandomIterator>
71 void SerialSort(RandomIterator begin, RandomIterator end)
73 SerialSort(begin, end, std::less<typename RandomIterator::value_type>());
76 template<
typename RandomIterator,
typename SortingFunction>
77 void SerialSort(RandomIterator begin, RandomIterator end,
78 const SortingFunction& sortingFunction)
80 std::sort(begin, end, sortingFunction);
void SerialFill(const RandomIterator &begin, const RandomIterator &end, const T &value)
Fills from begin to end with value.
Definition: Serial-Impl.h:17
void SerialFor(IndexType beginIndex, IndexType endIndex, const Function &function)
Makes a for-loop from beginIndex to endIndex.
Definition: Serial-Impl.h:28
Definition: pybind11Utils.h:24
void SerialSort(RandomIterator begin, RandomIterator end)
Sorts a container.
Definition: Serial-Impl.h:71