Disallow using signed offsets with partial_range
This commit is contained in:
parent
bca9531fbe
commit
0257b9ca1c
|
@ -7,6 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "dxxsconf.h"
|
#include "dxxsconf.h"
|
||||||
#include "compiler-begin.h"
|
#include "compiler-begin.h"
|
||||||
|
#include "compiler-type_traits.h"
|
||||||
|
|
||||||
template <typename iterator>
|
template <typename iterator>
|
||||||
struct partial_range_t
|
struct partial_range_t
|
||||||
|
@ -40,15 +41,18 @@ namespace boost
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename T>
|
template <typename T, typename U>
|
||||||
partial_range_t<typename T::iterator> partial_range(T &t, typename T::size_type l)
|
typename tt::enable_if<!tt::is_unsigned<U>::value, void>::type partial_range(T &, U) DXX_CXX11_EXPLICIT_DELETE;
|
||||||
|
|
||||||
|
template <typename T, typename U>
|
||||||
|
typename tt::enable_if<tt::is_unsigned<U>::value, partial_range_t<typename T::iterator>>::type partial_range(T &t, const U &l)
|
||||||
{
|
{
|
||||||
auto b = begin(t);
|
auto b = begin(t);
|
||||||
return partial_range_t<typename T::iterator>(b, b + l);
|
return partial_range_t<typename T::iterator>(b, b + l);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T, typename U>
|
||||||
partial_range_t<typename T::const_iterator> partial_range(const T &t, typename T::size_type l)
|
typename tt::enable_if<tt::is_unsigned<U>::value, partial_range_t<typename T::const_iterator>>::type partial_range(const T &t, const U &l)
|
||||||
{
|
{
|
||||||
auto b = begin(t);
|
auto b = begin(t);
|
||||||
return partial_range_t<typename T::const_iterator>(b, b + l);
|
return partial_range_t<typename T::const_iterator>(b, b + l);
|
||||||
|
|
|
@ -49,7 +49,7 @@ struct segmasks
|
||||||
struct segment_depth_array_t : public array<ubyte, MAX_SEGMENTS> {};
|
struct segment_depth_array_t : public array<ubyte, MAX_SEGMENTS> {};
|
||||||
|
|
||||||
extern int Highest_vertex_index; // Highest index in Vertices and Vertex_active, an efficiency hack
|
extern int Highest_vertex_index; // Highest index in Vertices and Vertex_active, an efficiency hack
|
||||||
extern int Highest_segment_index; // Highest index in Segments, an efficiency hack
|
extern unsigned Highest_segment_index; // Highest index in Segments, an efficiency hack
|
||||||
extern int Doing_lighting_hack_flag;
|
extern int Doing_lighting_hack_flag;
|
||||||
|
|
||||||
extern void compute_center_point_on_side(vms_vector *vp,segment *sp,int side);
|
extern void compute_center_point_on_side(vms_vector *vp,segment *sp,int side);
|
||||||
|
|
|
@ -52,7 +52,7 @@ int Num_vertices = 0;
|
||||||
int Num_segments = 0;
|
int Num_segments = 0;
|
||||||
|
|
||||||
int Highest_vertex_index=0;
|
int Highest_vertex_index=0;
|
||||||
int Highest_segment_index=0;
|
unsigned Highest_segment_index;
|
||||||
|
|
||||||
// Translate table to get opposite side of a face on a segment.
|
// Translate table to get opposite side of a face on a segment.
|
||||||
const char Side_opposite[MAX_SIDES_PER_SEGMENT] = {WRIGHT, WBOTTOM, WLEFT, WTOP, WFRONT, WBACK};
|
const char Side_opposite[MAX_SIDES_PER_SEGMENT] = {WRIGHT, WBOTTOM, WLEFT, WTOP, WFRONT, WBACK};
|
||||||
|
|
Loading…
Reference in a new issue