00001 00008 /***************************************************************************** 00009 ** Includes 00010 *****************************************************************************/ 00011 00012 #include <iomanip> 00013 #include <iostream> 00014 #include <ecl/config/portable_types.hpp> 00015 #include <ecl/type_traits/numeric_limits.hpp> 00016 00017 /***************************************************************************** 00018 ** using 00019 *****************************************************************************/ 00020 00021 using ecl::int8; 00022 using ecl::uint8; 00023 using ecl::int16; 00024 using ecl::uint16; 00025 using ecl::int32; 00026 using ecl::uint32; 00027 using ecl::int64; 00028 using ecl::uint64; 00029 using ecl::numeric_limits; 00030 00031 /***************************************************************************** 00032 ** Main 00033 *****************************************************************************/ 00034 00035 int main() { 00036 00037 std::cout << std::endl; 00038 std::cout << "***********************************************************" << std::endl; 00039 std::cout << " numeric_limits<>" << std::endl; 00040 std::cout << "***********************************************************" << std::endl; 00041 std::cout << std::endl; 00042 00043 std::cout << "numeric_limits<char>::bytes " << numeric_limits<char>::bytes << std::endl; 00044 std::cout << "numeric_limits<char>::bits " << numeric_limits<char>::bits << std::endl; 00045 std::cout << "numeric_limits<char>::min " << static_cast<int>(numeric_limits<char>::minimum) << std::endl; 00046 std::cout << "numeric_limits<char>::max " << static_cast<int>(numeric_limits<char>::maximum) << std::endl; 00047 std::cout << std::endl; 00048 00049 std::cout << "numeric_limits<unsigned char>::bytes " << numeric_limits<unsigned char>::bytes << std::endl; 00050 std::cout << "numeric_limits<unsigned char>::bits " << numeric_limits<unsigned char>::bits << std::endl; 00051 std::cout << "numeric_limits<unsigned char>::min " << static_cast<int>(numeric_limits<unsigned char>::minimum) << std::endl; 00052 std::cout << "numeric_limits<unsigned char>::max " << static_cast<int>(numeric_limits<unsigned char>::maximum) << std::endl; 00053 std::cout << std::endl; 00054 00055 std::cout << "numeric_limits<short>::bytes " << numeric_limits<short>::bytes << std::endl; 00056 std::cout << "numeric_limits<short>::bits " << numeric_limits<short>::bits << std::endl; 00057 std::cout << "numeric_limits<short>::min " << numeric_limits<short>::minimum << std::endl; 00058 std::cout << "numeric_limits<short>::max " << numeric_limits<short>::maximum << std::endl; 00059 std::cout << std::endl; 00060 00061 std::cout << "numeric_limits<unsigned short>::bytes " << numeric_limits<unsigned short>::bytes << std::endl; 00062 std::cout << "numeric_limits<unsigned short>::bits " << numeric_limits<unsigned short>::bits << std::endl; 00063 std::cout << "numeric_limits<unsigned short>::min " << numeric_limits<unsigned short>::minimum << std::endl; 00064 std::cout << "numeric_limits<unsigned short>::max " << numeric_limits<unsigned short>::maximum << std::endl; 00065 std::cout << std::endl; 00066 00067 std::cout << "numeric_limits<int>::bytes " << numeric_limits<int>::bytes << std::endl; 00068 std::cout << "numeric_limits<int>::bits " << numeric_limits<int>::bits << std::endl; 00069 std::cout << "numeric_limits<int>::min " << numeric_limits<int>::minimum << std::endl; 00070 std::cout << "numeric_limits<int>::max " << numeric_limits<int>::maximum << std::endl; 00071 std::cout << std::endl; 00072 00073 std::cout << "numeric_limits<unsigned int>::bytes " << numeric_limits<unsigned int>::bytes << std::endl; 00074 std::cout << "numeric_limits<unsigned int>::bits " << numeric_limits<unsigned int>::bits << std::endl; 00075 std::cout << "numeric_limits<unsigned int>::min " << numeric_limits<unsigned int>::minimum << std::endl; 00076 std::cout << "numeric_limits<unsigned int>::max " << numeric_limits<unsigned int>::maximum << std::endl; 00077 std::cout << std::endl; 00078 00079 std::cout << "numeric_limits<long>::bytes " << numeric_limits<long>::bytes << std::endl; 00080 std::cout << "numeric_limits<long>::bits " << numeric_limits<long>::bits << std::endl; 00081 std::cout << "numeric_limits<long>::min " << numeric_limits<long>::minimum << std::endl; 00082 std::cout << "numeric_limits<long>::max " << numeric_limits<long>::maximum << std::endl; 00083 std::cout << std::endl; 00084 00085 std::cout << "numeric_limits<unsigned long>::bytes " << numeric_limits<unsigned long>::bytes << std::endl; 00086 std::cout << "numeric_limits<unsigned long>::bits " << numeric_limits<unsigned long>::bits << std::endl; 00087 std::cout << "numeric_limits<unsigned long>::min " << numeric_limits<unsigned long>::minimum << std::endl; 00088 std::cout << "numeric_limits<unsigned long>::max " << numeric_limits<unsigned long>::maximum << std::endl; 00089 std::cout << std::endl; 00090 00091 std::cout << "numeric_limits<long long>::bytes " << numeric_limits<long long>::bytes << std::endl; 00092 std::cout << "numeric_limits<long long>::bits " << numeric_limits<long long>::bits << std::endl; 00093 std::cout << "numeric_limits<long long>::min " << numeric_limits<long long>::minimum << std::endl; 00094 std::cout << "numeric_limits<long long>::max " << numeric_limits<long long>::maximum << std::endl; 00095 std::cout << std::endl; 00096 00097 std::cout << "numeric_limits<unsigned long long>::bytes " << numeric_limits<unsigned long long>::bytes << std::endl; 00098 std::cout << "numeric_limits<unsigned long long>::bits " << numeric_limits<unsigned long long>::bits << std::endl; 00099 std::cout << "numeric_limits<unsigned long long>::min " << numeric_limits<unsigned long long>::minimum << std::endl; 00100 std::cout << "numeric_limits<unsigned long long>::max " << numeric_limits<unsigned long long>::maximum << std::endl; 00101 00102 // std::cout << std::endl; 00103 // std::cout << "***********************************************************" << std::endl; 00104 // std::cout << " Integer<>" << std::endl; 00105 // std::cout << "***********************************************************" << std::endl; 00106 // std::cout << std::endl; 00107 // 00108 // Integer<8>::type int_8 = 0x03; 00109 // Integer<8>::utype uint_8 = 0x03; 00110 // std::cout << "Integer<8>::type: " << int_8 << std::endl; 00111 // std::cout << "Integer<8>::utype: " << uint_8 << std::endl; 00112 // std::cout << "Integer<8>::min " << static_cast<int>(Integer<8>::min) << std::endl; 00113 // std::cout << "Integer<8>::one " << static_cast<int>(Integer<8>::one) << std::endl; 00114 // std::cout << "Integer<8>::max " << static_cast<int>(Integer<8>::max) << std::endl; 00115 // std::cout << "Integer<8>::umin " << static_cast<int>(Integer<8>::umin) << std::endl; 00116 // std::cout << "Integer<8>::uone " << static_cast<int>(Integer<8>::uone) << std::endl; 00117 // std::cout << "Integer<8>::umax " << static_cast<int>(Integer<8>::umax) << std::endl; 00118 // std::cout << std::endl; 00119 // 00120 // Integer<16>::type int_16 = 0x03; 00121 // Integer<16>::utype uint_16 = 0x03; 00122 // std::cout << "Integer<16>::type: " << int_16 << std::endl; 00123 // std::cout << "Integer<16>::utype: " << uint_16 << std::endl; 00124 // std::cout << "Integer<16>::min " << Integer<16>::min << std::endl; 00125 // std::cout << "Integer<16>::one " << Integer<16>::one << std::endl; 00126 // std::cout << "Integer<16>::max " << Integer<16>::max << std::endl; // This doesn't output the correct value. 00127 // std::cout << "Integer<16>::umin " << Integer<16>::umin << std::endl; 00128 // std::cout << "Integer<16>::uone " << Integer<16>::uone << std::endl; 00129 // std::cout << "Integer<16>::umax " << Integer<16>::umax << std::endl; 00130 // std::cout << std::endl; 00131 // 00132 // Integer<32>::type int_32 = 0x03; 00133 // Integer<32>::utype uint_32 = 0x03; 00134 // std::cout << "Integer<32>::type: " << int_32 << std::endl; 00135 // std::cout << "Integer<32>::utype: " << uint_32 << std::endl; 00136 // std::cout << "Integer<32>::min " << Integer<32>::min << std::endl; 00137 // std::cout << "Integer<32>::one " << Integer<32>::one << std::endl; 00138 // std::cout << "Integer<32>::max " << Integer<32>::max << std::endl; // This doesn't output the correct value. 00139 // std::cout << "Integer<32>::umin " << Integer<32>::umin << std::endl; 00140 // std::cout << "Integer<32>::uone " << Integer<32>::uone << std::endl; 00141 // std::cout << "Integer<32>::umax " << Integer<32>::umax << std::endl; 00142 // std::cout << std::endl; 00143 // 00144 // Integer<64>::type int_64 = 0x03; 00145 // Integer<64>::utype uint_64 = 0x03; 00146 // std::cout << "Integer<64>::type: " << int_64 << std::endl; 00147 // std::cout << "Integer<64>::utype: " << uint_64 << std::endl; 00148 // std::cout << "Integer<64>::min " << Integer<64>::min << std::endl; 00149 // std::cout << "Integer<64>::one " << Integer<64>::one << std::endl; 00150 // std::cout << "Integer<64>::max " << Integer<64>::max << std::endl; // This doesn't output the correct value. 00151 // std::cout << "Integer<64>::umin " << Integer<64>::umin << std::endl; 00152 // std::cout << "Integer<64>::uone " << Integer<64>::uone << std::endl; 00153 // std::cout << "Integer<64>::umax " << Integer<64>::umax << std::endl; 00154 // std::cout << std::endl; 00155 00156 return 0; 00157 }