11 #ifndef CUBBYFLOW_SERIAL_IMPL_HPP 12 #define CUBBYFLOW_SERIAL_IMPL_HPP 19 template <
typename RandomIterator,
typename T>
20 void SerialFill(
const RandomIterator& begin,
const RandomIterator& end,
23 size_t size =
static_cast<size_t>(end - begin);
26 [begin, value](
size_t i) { begin[i] = value; });
29 template <
typename IndexType,
typename Function>
30 void SerialFor(IndexType beginIndex, IndexType endIndex,
31 const Function&
function)
33 for (IndexType i = beginIndex; i < endIndex; ++i)
39 template <
typename IndexType,
typename Function>
40 void SerialFor(IndexType beginIndexX, IndexType endIndexX,
41 IndexType beginIndexY, IndexType endIndexY,
42 const Function&
function)
44 for (IndexType j = beginIndexY; j < endIndexY; ++j)
46 for (IndexType i = beginIndexX; i < endIndexX; ++i)
53 template <
typename IndexType,
typename Function>
54 void SerialFor(IndexType beginIndexX, IndexType endIndexX,
55 IndexType beginIndexY, IndexType endIndexY,
56 IndexType beginIndexZ, IndexType endIndexZ,
57 const Function&
function)
59 for (IndexType k = beginIndexZ; k < endIndexZ; ++k)
61 for (IndexType j = beginIndexY; j < endIndexY; ++j)
63 for (IndexType i = beginIndexX; i < endIndexX; ++i)
71 template <
typename RandomIterator>
72 void SerialSort(RandomIterator begin, RandomIterator end)
74 SerialSort(begin, end, std::less<typename RandomIterator::value_type>());
77 template <
typename RandomIterator,
typename SortingFunction>
78 void SerialSort(RandomIterator begin, RandomIterator end,
79 const SortingFunction& sortingFunction)
81 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.hpp:20
void SerialFor(IndexType beginIndex, IndexType endIndex, const Function &function)
Makes a for-loop from beginIndex to endIndex.
Definition: Serial-Impl.hpp:30
Definition: pybind11Utils.hpp:20
void SerialSort(RandomIterator begin, RandomIterator end)
Sorts a container.
Definition: Serial-Impl.hpp:72