Mercurial > hg > svcore
changeset 1049:10055a284716 cxx11
Doh
author | Chris Cannam |
---|---|
date | Tue, 10 Mar 2015 20:02:02 +0000 |
parents | fe39581d249b |
children | 5ad98be7f635 |
files | base/BaseTypes.h |
diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/base/BaseTypes.h Tue Mar 10 20:02:02 2015 +0000 @@ -0,0 +1,21 @@ + +#ifndef BASE_TYPES_H +#define BASE_TYPES_H + +#include <cstdint> + +typedef int64_t sv_frame_t; +typedef double sv_samplerate_t; + +template<typename T, typename C> +bool in_range_for(const C &container, T i) +{ + if (i < 0) return false; + if (sizeof(T) > sizeof(typename C::size_type)) { + return i < static_cast<T>(container.size()); + } else { + return static_cast<typename C::size_type>(i) < container.size(); + } +} + +#endif