AudRecordLib
ctnumlimits.h
Go to the documentation of this file.
00001 
00005 #ifndef CTNUMLIMITS_AUDRECORD_H
00006 #define CTNUMLIMITS_AUDRECORD_H
00007 
00008 #pragma once
00009 
00010 #include <climits>
00011 
00019 template<class Type>
00020 struct CTNumLimits
00021 {};
00022 
00024 template<>
00025 struct CTNumLimits<char>
00026 {
00027         static const char max = SCHAR_MAX; 
00028         static const char min = SCHAR_MIN;
00029 };
00030 
00032 template<>
00033 struct CTNumLimits<short>
00034 {
00035         static const short max = SHRT_MAX; 
00036         static const short min = SHRT_MIN;
00037 };
00038 
00040 template<>
00041 struct CTNumLimits<long>
00042 {
00043         static const long max = LONG_MAX; 
00044         static const long min = LONG_MIN;
00045 };
00046 
00048 template<>
00049 struct CTNumLimits<float>
00050 {
00051         static const float max;
00052         static const float min;
00053 };
00054 
00055 // Why C++ doesn't allow these to be initialised like the rest I'll never know
00056 // the __declspec(selectany) allows the multiple definition to be resolved
00057 // by the linker. Since they'll always be the same, there's no
00058 // harm in letting that happen
00059 __declspec(selectany) const float CTNumLimits<float>::max = FLT_MAX;
00060 __declspec(selectany) const float CTNumLimits<float>::min = FLT_MIN;
00061 
00064 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Defines