changeset 1050:5ad98be7f635 cxx11

Merge
author Chris Cannam
date Tue, 10 Mar 2015 20:03:08 +0000
parents 10055a284716 (diff) c7e9afcbf070 (current diff)
children cafd65fc411b
files
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:03:08 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