comparison base/BaseTypes.h @ 1429:48e9f538e6e9

Untabify
author Chris Cannam
date Thu, 01 Mar 2018 18:02:22 +0000
parents 54af1e21705c
children 710e6250a401 a7485c1bdba5
comparison
equal deleted inserted replaced
1428:87ae75da6527 1429:48e9f538e6e9
36 template<typename T, typename C> 36 template<typename T, typename C>
37 bool in_range_for(const C &container, T i) 37 bool in_range_for(const C &container, T i)
38 { 38 {
39 if (i < 0) return false; 39 if (i < 0) return false;
40 if (sizeof(T) > sizeof(typename C::size_type)) { 40 if (sizeof(T) > sizeof(typename C::size_type)) {
41 return i < static_cast<T>(container.size()); 41 return i < static_cast<T>(container.size());
42 } else { 42 } else {
43 return static_cast<typename C::size_type>(i) < container.size(); 43 return static_cast<typename C::size_type>(i) < container.size();
44 } 44 }
45 } 45 }
46 46
47 /** Sample rate. We have to deal with sample rates provided as float 47 /** Sample rate. We have to deal with sample rates provided as float
48 or (unsigned) int types, so we might as well have a type that can 48 or (unsigned) int types, so we might as well have a type that can