Use T::index_type for highest_valid

This commit is contained in:
Kp 2015-07-13 01:09:36 +00:00
parent 012b65a37c
commit 745de17c41
3 changed files with 4 additions and 2 deletions

View file

@ -2,7 +2,7 @@
#include <cstddef>
#include <iterator>
template <typename T, typename I = std::size_t>
template <typename T, typename I = typename T::index_type>
struct highest_valid_t
{
struct iterator : std::iterator<std::forward_iterator_tag, I>
@ -36,7 +36,7 @@ struct highest_valid_t
};
template <typename T>
highest_valid_t<T> highest_valid(T &t, std::size_t start = 0)
highest_valid_t<T> highest_valid(T &t, typename T::index_type start = 0)
{
return {t, start};
}

View file

@ -395,6 +395,7 @@ struct obj_position
struct object_array_t : array<object, MAX_OBJECTS>
{
typedef uint16_t index_type;
int highest;
#define Highest_object_index Objects.highest
typedef array<object, MAX_OBJECTS> array_t;

View file

@ -186,6 +186,7 @@ struct group
struct segment_array_t : public array<segment, MAX_SEGMENTS>
{
typedef uint16_t index_type;
unsigned highest;
#define Highest_segment_index Segments.highest
typedef array<segment, MAX_SEGMENTS> array_t;