Mercurial > hg > svcore
comparison base/BaseTypes.h @ 1049:10055a284716 cxx11
Doh
author | Chris Cannam |
---|---|
date | Tue, 10 Mar 2015 20:02:02 +0000 |
parents | |
children | cafd65fc411b |
comparison
equal
deleted
inserted
replaced
1043:fe39581d249b | 1049:10055a284716 |
---|---|
1 | |
2 #ifndef BASE_TYPES_H | |
3 #define BASE_TYPES_H | |
4 | |
5 #include <cstdint> | |
6 | |
7 typedef int64_t sv_frame_t; | |
8 typedef double sv_samplerate_t; | |
9 | |
10 template<typename T, typename C> | |
11 bool in_range_for(const C &container, T i) | |
12 { | |
13 if (i < 0) return false; | |
14 if (sizeof(T) > sizeof(typename C::size_type)) { | |
15 return i < static_cast<T>(container.size()); | |
16 } else { | |
17 return static_cast<typename C::size_type>(i) < container.size(); | |
18 } | |
19 } | |
20 | |
21 #endif |