Skip to content

Commit 1f9c660

Browse files
committed
Add distance algo
1 parent 96974f0 commit 1f9c660

File tree

5 files changed

+150
-121
lines changed

5 files changed

+150
-121
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ IF( CPPCORE_BUILD_UNITTESTS )
141141

142142
SET( cppcore_container_test_src
143143
test/container/TArrayTest.cpp
144+
test/container/TAlgorithmTest.cpp
144145
test/container/THashMapTest.cpp
145146
test/container/TListTest.cpp
146147
test/container/TQueueTest.cpp
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#pragma once
2+
3+
#include <cassert>
4+
5+
namespace cppcore {
6+
7+
template<class TIt>
8+
inline size_t distance(TIt begin, TIt end) {
9+
assert(begin < end);
10+
const size_t distance = end - begin;
11+
return distance;
12+
}
13+
14+
} // namespace cppcore

0 commit comments

Comments
 (0)