You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

531 lines
18 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: stlsoft/util/limit_traits.h (originally MLLimits.h; ::SynesisStd)
  3. *
  4. * Purpose: limit_traits classes. Provides nothing that is not in
  5. * std::numeric_limits, but uses minimum() and maximum() rather
  6. * than min() and max(), since some compilers are not well-behaved
  7. * in making these functions rather than macros.
  8. *
  9. * Created: 16th January 2002
  10. * Updated: 10th August 2009
  11. *
  12. * Thanks: To Jonathan Wakely for help with Solaris compatibility.
  13. *
  14. * Home: http://stlsoft.org/
  15. *
  16. * Copyright (c) 2002-2009, Matthew Wilson and Synesis Software
  17. * All rights reserved.
  18. *
  19. * Redistribution and use in source and binary forms, with or without
  20. * modification, are permitted provided that the following conditions are met:
  21. *
  22. * - Redistributions of source code must retain the above copyright notice, this
  23. * list of conditions and the following disclaimer.
  24. * - Redistributions in binary form must reproduce the above copyright notice,
  25. * this list of conditions and the following disclaimer in the documentation
  26. * and/or other materials provided with the distribution.
  27. * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
  28. * any contributors may be used to endorse or promote products derived from
  29. * this software without specific prior written permission.
  30. *
  31. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  32. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  33. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  34. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  35. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  36. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  37. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  38. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  39. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  40. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41. * POSSIBILITY OF SUCH DAMAGE.
  42. *
  43. * ////////////////////////////////////////////////////////////////////// */
  44. /** \file stlsoft/util/limit_traits.h
  45. *
  46. * \brief [C, C++] Macros, constants and traits (stlsoft::limit_traits) for
  47. * classes
  48. * (\ref group__library__utility "Utility" Library).
  49. */
  50. #ifndef STLSOFT_INCL_STLSOFT_UTIL_H_LIMIT_TRAITS
  51. #define STLSOFT_INCL_STLSOFT_UTIL_H_LIMIT_TRAITS
  52. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  53. # define STLSOFT_VER_STLSOFT_UTIL_H_LIMIT_TRAITS_MAJOR 4
  54. # define STLSOFT_VER_STLSOFT_UTIL_H_LIMIT_TRAITS_MINOR 2
  55. # define STLSOFT_VER_STLSOFT_UTIL_H_LIMIT_TRAITS_REVISION 6
  56. # define STLSOFT_VER_STLSOFT_UTIL_H_LIMIT_TRAITS_EDIT 60
  57. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  58. /* /////////////////////////////////////////////////////////////////////////
  59. * Includes
  60. */
  61. #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
  62. # include <stlsoft/stlsoft.h>
  63. #endif /* !STLSOFT_INCL_STLSOFT_H_STLSOFT */
  64. #if defined(__cplusplus)
  65. # ifndef STLSOFT_INCL_STLSOFT_UTIL_HPP_SIZE_TRAITS
  66. # include <stlsoft/util/size_traits.hpp>
  67. # endif /* !STLSOFT_INCL_STLSOFT_UTIL_HPP_SIZE_TRAITS */
  68. #endif /* __cplusplus */
  69. /* /////////////////////////////////////////////////////////////////////////
  70. * Namespace
  71. */
  72. #ifndef _STLSOFT_NO_NAMESPACE
  73. namespace stlsoft
  74. {
  75. #endif /* _STLSOFT_NO_NAMESPACE */
  76. /* /////////////////////////////////////////////////////////////////////////
  77. * Constants & definitions
  78. */
  79. #define STLSOFT_GEN_SINT8_SUFFIX(i) (i)
  80. #define STLSOFT_GEN_UINT8_SUFFIX(i) (i ## U)
  81. #define STLSOFT_GEN_SINT16_SUFFIX(i) (i)
  82. #define STLSOFT_GEN_UINT16_SUFFIX(i) (i ## U)
  83. #if _STLSOFT_SIZEOF_LONG == 4
  84. # define STLSOFT_GEN_SINT32_SUFFIX(i) (i ## L)
  85. # define STLSOFT_GEN_UINT32_SUFFIX(i) (i ## UL)
  86. #else /* ? _STLSOFT_SIZEOF_LONG */
  87. # define STLSOFT_GEN_SINT32_SUFFIX(i) (i)
  88. # define STLSOFT_GEN_UINT32_SUFFIX(i) (i ## U)
  89. #endif /* _STLSOFT_SIZEOF_LONG */
  90. #if ( ( defined(STLSOFT_COMPILER_IS_BORLAND) && \
  91. __BORLANDC__ >= 0x0582) || \
  92. defined(STLSOFT_COMPILER_IS_DMC) || \
  93. defined(STLSOFT_COMPILER_IS_COMO) || \
  94. defined(STLSOFT_COMPILER_IS_GCC) || \
  95. defined(STLSOFT_COMPILER_IS_MWERKS) || \
  96. defined(STLSOFT_COMPILER_IS_SUNPRO))
  97. # define STLSOFT_GEN_SINT64_SUFFIX(i) (i ## LL)
  98. # define STLSOFT_GEN_UINT64_SUFFIX(i) (i ## ULL)
  99. #elif ( defined(STLSOFT_COMPILER_IS_BORLAND) || \
  100. defined(STLSOFT_COMPILER_IS_INTEL) || \
  101. defined(STLSOFT_COMPILER_IS_MSVC) || \
  102. defined(STLSOFT_COMPILER_IS_VECTORC) || \
  103. defined(STLSOFT_COMPILER_IS_WATCOM))
  104. # define STLSOFT_GEN_SINT64_SUFFIX(i) (i ## L)
  105. # define STLSOFT_GEN_UINT64_SUFFIX(i) (i ## UL)
  106. #else
  107. # error Compiler not discriminated
  108. #endif /* compiler */
  109. #define STLSOFT_LIMIT_TRAITS__SINT8_MIN (- STLSOFT_GEN_SINT8_SUFFIX(127) - 1)
  110. #define STLSOFT_LIMIT_TRAITS__SINT8_MAX (+ STLSOFT_GEN_SINT8_SUFFIX(127))
  111. #define STLSOFT_LIMIT_TRAITS__UINT8_MIN ( STLSOFT_GEN_UINT8_SUFFIX(0))
  112. #define STLSOFT_LIMIT_TRAITS__UINT8_MAX ( STLSOFT_GEN_UINT8_SUFFIX(255))
  113. #define STLSOFT_LIMIT_TRAITS__SINT16_MIN (- STLSOFT_GEN_SINT16_SUFFIX(32767) - 1)
  114. #define STLSOFT_LIMIT_TRAITS__SINT16_MAX (+ STLSOFT_GEN_SINT16_SUFFIX(32767))
  115. #define STLSOFT_LIMIT_TRAITS__UINT16_MIN ( STLSOFT_GEN_UINT16_SUFFIX(0))
  116. #define STLSOFT_LIMIT_TRAITS__UINT16_MAX ( STLSOFT_GEN_UINT16_SUFFIX(65535))
  117. #define STLSOFT_LIMIT_TRAITS__SINT32_MIN (- STLSOFT_GEN_SINT32_SUFFIX(2147483647) - 1)
  118. #define STLSOFT_LIMIT_TRAITS__SINT32_MAX (+ STLSOFT_GEN_SINT32_SUFFIX(2147483647))
  119. #define STLSOFT_LIMIT_TRAITS__UINT32_MIN ( STLSOFT_GEN_UINT32_SUFFIX(0))
  120. #define STLSOFT_LIMIT_TRAITS__UINT32_MAX ( STLSOFT_GEN_UINT32_SUFFIX(4294967295))
  121. #define STLSOFT_LIMIT_TRAITS__SINT64_MIN (- STLSOFT_GEN_SINT64_SUFFIX(9223372036854775807) - 1)
  122. #define STLSOFT_LIMIT_TRAITS__SINT64_MAX (+ STLSOFT_GEN_SINT64_SUFFIX(9223372036854775807) )
  123. #define STLSOFT_LIMIT_TRAITS__UINT64_MIN ( STLSOFT_GEN_UINT64_SUFFIX(0) )
  124. #define STLSOFT_LIMIT_TRAITS__UINT64_MAX ( STLSOFT_GEN_UINT64_SUFFIX(18446744073709551615) )
  125. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  126. # define __STLSOFT_GEN_SINT8_SUFFIX(i) STLSOFT_GEN_SINT8_SUFFIX(i)
  127. # define __STLSOFT_GEN_UINT8_SUFFIX(i) STLSOFT_GEN_UINT8_SUFFIX(i)
  128. # define __STLSOFT_GEN_SINT16_SUFFIX(i) STLSOFT_GEN_SINT16_SUFFIX(i)
  129. # define __STLSOFT_GEN_UINT16_SUFFIX(i) STLSOFT_GEN_UINT16_SUFFIX(i)
  130. # define __STLSOFT_GEN_SINT32_SUFFIX(i) STLSOFT_GEN_SINT32_SUFFIX(i)
  131. # define __STLSOFT_GEN_UINT32_SUFFIX(i) STLSOFT_GEN_UINT32_SUFFIX(i)
  132. # define __STLSOFT_GEN_SINT64_SUFFIX(i) STLSOFT_GEN_SINT64_SUFFIX(i)
  133. # define __STLSOFT_GEN_UINT64_SUFFIX(i) STLSOFT_GEN_UINT64_SUFFIX(i)
  134. # define __STLSOFT_LIMIT_TRAITS__SINT8_MIN STLSOFT_LIMIT_TRAITS__SINT8_MIN
  135. # define __STLSOFT_LIMIT_TRAITS__SINT8_MAX STLSOFT_LIMIT_TRAITS__SINT8_MAX
  136. # define __STLSOFT_LIMIT_TRAITS__UINT8_MIN STLSOFT_LIMIT_TRAITS__UINT8_MIN
  137. # define __STLSOFT_LIMIT_TRAITS__UINT8_MAX STLSOFT_LIMIT_TRAITS__UINT8_MAX
  138. # define __STLSOFT_LIMIT_TRAITS__SINT16_MIN STLSOFT_LIMIT_TRAITS__SINT16_MIN
  139. # define __STLSOFT_LIMIT_TRAITS__SINT16_MAX STLSOFT_LIMIT_TRAITS__SINT16_MAX
  140. # define __STLSOFT_LIMIT_TRAITS__UINT16_MIN STLSOFT_LIMIT_TRAITS__UINT16_MIN
  141. # define __STLSOFT_LIMIT_TRAITS__UINT16_MAX STLSOFT_LIMIT_TRAITS__UINT16_MAX
  142. # define __STLSOFT_LIMIT_TRAITS__SINT32_MIN STLSOFT_LIMIT_TRAITS__SINT32_MIN
  143. # define __STLSOFT_LIMIT_TRAITS__SINT32_MAX STLSOFT_LIMIT_TRAITS__SINT32_MAX
  144. # define __STLSOFT_LIMIT_TRAITS__UINT32_MIN STLSOFT_LIMIT_TRAITS__UINT32_MIN
  145. # define __STLSOFT_LIMIT_TRAITS__UINT32_MAX STLSOFT_LIMIT_TRAITS__UINT32_MAX
  146. # define __STLSOFT_LIMIT_TRAITS__SINT64_MIN STLSOFT_LIMIT_TRAITS__SINT64_MIN
  147. # define __STLSOFT_LIMIT_TRAITS__SINT64_MAX STLSOFT_LIMIT_TRAITS__SINT64_MAX
  148. # define __STLSOFT_LIMIT_TRAITS__UINT64_MIN STLSOFT_LIMIT_TRAITS__UINT64_MIN
  149. # define __STLSOFT_LIMIT_TRAITS__UINT64_MAX STLSOFT_LIMIT_TRAITS__UINT64_MAX
  150. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  151. /* /////////////////////////////////////////////////////////////////////////
  152. * Classes
  153. */
  154. #ifdef __cplusplus
  155. # ifdef STLSOFT_DOCUMENTATION_SKIP_SECTION
  156. /** \brief Traits for determining the minimum and maximum values of types
  157. *
  158. * \ingroup group__library__utility
  159. *
  160. * limit_traits is a traits class for acquiring the minimum and maximum values
  161. * of types.
  162. *
  163. \code
  164. assert(stlsoft::limit_traits<ss_sint16_t>::minimum() == -32768);
  165. assert(stlsoft::limit_traits<ss_sint16_t>::maximum() == 32767);
  166. \endcode
  167. * \param T The type
  168. *
  169. * \note Provides nothing that is not in std::numeric_limits, but uses
  170. * minimum() and maximum() rather than min() and max(), since some
  171. * compilers are not well-behaved in making these functions rather than
  172. * macros.
  173. *
  174. */
  175. template <ss_typename_param_k T>
  176. struct limit_traits
  177. {
  178. public:
  179. /** The value type */
  180. typedef T value_type;
  181. public:
  182. /** Returns the minimum value for the type */
  183. static value_type minimum();
  184. /** Returns the maximum value for the type */
  185. static value_type maximum();
  186. # ifdef STLSOFT_CF_MEMBER_CONSTANT_SUPPORT
  187. static const value_type minimum_value = ???;
  188. static const value_type maximum_value = ???;
  189. # endif /* STLSOFT_CF_MEMBER_CONSTANT_SUPPORT */
  190. };
  191. # else /* ? STLSOFT_DOCUMENTATION_SKIP_SECTION */
  192. /* class limit_traits */
  193. template <ss_typename_param_k T>
  194. struct limit_traits;
  195. #ifdef STLSOFT_CF_NATIVE_BOOL_SUPPORT
  196. STLSOFT_TEMPLATE_SPECIALISATION
  197. struct limit_traits<ss_bool_t>
  198. {
  199. public:
  200. typedef ss_bool_t value_type;
  201. public:
  202. static value_type minimum() { return false; }
  203. static value_type maximum() { return true; }
  204. # ifdef STLSOFT_CF_MEMBER_CONSTANT_SUPPORT
  205. static const value_type minimum_value = false;
  206. static const value_type maximum_value = true;
  207. # endif /* STLSOFT_CF_MEMBER_CONSTANT_SUPPORT */
  208. };
  209. #endif /* STLSOFT_CF_NATIVE_BOOL_SUPPORT */
  210. # ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  211. template <ss_typename_param_k T>
  212. struct limit_traits_fixed;
  213. /* s/uint8 */
  214. STLSOFT_TEMPLATE_SPECIALISATION
  215. struct limit_traits_fixed<ss_sint8_t>
  216. {
  217. public:
  218. typedef ss_sint8_t value_type;
  219. public:
  220. static value_type minimum() { return STLSOFT_LIMIT_TRAITS__SINT8_MIN; }
  221. static value_type maximum() { return STLSOFT_LIMIT_TRAITS__SINT8_MAX; }
  222. # ifdef STLSOFT_CF_MEMBER_CONSTANT_SUPPORT
  223. static const value_type minimum_value = STLSOFT_LIMIT_TRAITS__SINT8_MIN;
  224. static const value_type maximum_value = STLSOFT_LIMIT_TRAITS__SINT8_MAX;
  225. # endif /* STLSOFT_CF_MEMBER_CONSTANT_SUPPORT */
  226. };
  227. STLSOFT_TEMPLATE_SPECIALISATION
  228. struct limit_traits_fixed<ss_uint8_t>
  229. {
  230. public:
  231. typedef ss_uint8_t value_type;
  232. public:
  233. static value_type minimum() { return STLSOFT_LIMIT_TRAITS__UINT8_MIN; }
  234. static value_type maximum() { return STLSOFT_LIMIT_TRAITS__UINT8_MAX; }
  235. # ifdef STLSOFT_CF_MEMBER_CONSTANT_SUPPORT
  236. static const value_type minimum_value = STLSOFT_LIMIT_TRAITS__UINT8_MIN;
  237. static const value_type maximum_value = STLSOFT_LIMIT_TRAITS__UINT8_MAX;
  238. # endif /* STLSOFT_CF_MEMBER_CONSTANT_SUPPORT */
  239. };
  240. /* s/uint16 */
  241. STLSOFT_TEMPLATE_SPECIALISATION
  242. struct limit_traits_fixed<ss_sint16_t>
  243. {
  244. public:
  245. typedef ss_sint16_t value_type;
  246. public:
  247. static value_type minimum() { return STLSOFT_LIMIT_TRAITS__SINT16_MIN; }
  248. static value_type maximum() { return STLSOFT_LIMIT_TRAITS__SINT16_MAX; }
  249. # ifdef STLSOFT_CF_MEMBER_CONSTANT_SUPPORT
  250. static const value_type minimum_value = STLSOFT_LIMIT_TRAITS__SINT16_MIN;
  251. static const value_type maximum_value = STLSOFT_LIMIT_TRAITS__SINT16_MAX;
  252. # endif /* STLSOFT_CF_MEMBER_CONSTANT_SUPPORT */
  253. };
  254. STLSOFT_TEMPLATE_SPECIALISATION
  255. struct limit_traits_fixed<ss_uint16_t>
  256. {
  257. public:
  258. typedef ss_uint16_t value_type;
  259. public:
  260. static value_type minimum() { return STLSOFT_LIMIT_TRAITS__UINT16_MIN; }
  261. static value_type maximum() { return STLSOFT_LIMIT_TRAITS__UINT16_MAX; }
  262. # ifdef STLSOFT_CF_MEMBER_CONSTANT_SUPPORT
  263. static const value_type minimum_value = STLSOFT_LIMIT_TRAITS__UINT16_MIN;
  264. static const value_type maximum_value = STLSOFT_LIMIT_TRAITS__UINT16_MAX;
  265. # endif /* STLSOFT_CF_MEMBER_CONSTANT_SUPPORT */
  266. };
  267. /* s/uint32 */
  268. STLSOFT_TEMPLATE_SPECIALISATION
  269. struct limit_traits_fixed<ss_sint32_t>
  270. {
  271. public:
  272. typedef ss_sint32_t value_type;
  273. public:
  274. static value_type minimum() { return STLSOFT_LIMIT_TRAITS__SINT32_MIN; }
  275. static value_type maximum() { return STLSOFT_LIMIT_TRAITS__SINT32_MAX; }
  276. # ifdef STLSOFT_CF_MEMBER_CONSTANT_SUPPORT
  277. static const value_type minimum_value = STLSOFT_LIMIT_TRAITS__SINT32_MIN;
  278. static const value_type maximum_value = STLSOFT_LIMIT_TRAITS__SINT32_MAX;
  279. # endif /* STLSOFT_CF_MEMBER_CONSTANT_SUPPORT */
  280. };
  281. STLSOFT_TEMPLATE_SPECIALISATION
  282. struct limit_traits_fixed<ss_uint32_t>
  283. {
  284. public:
  285. typedef ss_uint32_t value_type;
  286. public:
  287. static value_type minimum() { return STLSOFT_LIMIT_TRAITS__UINT32_MIN; }
  288. static value_type maximum() { return STLSOFT_LIMIT_TRAITS__UINT32_MAX; }
  289. # ifdef STLSOFT_CF_MEMBER_CONSTANT_SUPPORT
  290. static const value_type minimum_value = STLSOFT_LIMIT_TRAITS__UINT32_MIN;
  291. static const value_type maximum_value = STLSOFT_LIMIT_TRAITS__UINT32_MAX;
  292. # endif /* STLSOFT_CF_MEMBER_CONSTANT_SUPPORT */
  293. };
  294. #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
  295. /* s/uint64 */
  296. STLSOFT_TEMPLATE_SPECIALISATION
  297. struct limit_traits_fixed<ss_sint64_t>
  298. {
  299. public:
  300. typedef ss_sint64_t value_type;
  301. public:
  302. static value_type minimum() { return STLSOFT_LIMIT_TRAITS__SINT64_MIN; }
  303. static value_type maximum() { return STLSOFT_LIMIT_TRAITS__SINT64_MAX; }
  304. # if defined(STLSOFT_CF_MEMBER_CONSTANT_SUPPORT) && \
  305. !defined(STLSOFT_COMPILER_IS_BORLAND)
  306. static const value_type minimum_value = STLSOFT_LIMIT_TRAITS__SINT64_MIN;
  307. static const value_type maximum_value = STLSOFT_LIMIT_TRAITS__SINT64_MAX;
  308. # endif /* STLSOFT_CF_MEMBER_CONSTANT_SUPPORT */
  309. };
  310. STLSOFT_TEMPLATE_SPECIALISATION
  311. struct limit_traits_fixed<ss_uint64_t>
  312. {
  313. public:
  314. typedef ss_uint64_t value_type;
  315. public:
  316. static value_type minimum() { return STLSOFT_LIMIT_TRAITS__UINT64_MIN; }
  317. static value_type maximum() { return STLSOFT_LIMIT_TRAITS__UINT64_MAX; }
  318. # if defined(STLSOFT_CF_MEMBER_CONSTANT_SUPPORT) && \
  319. !defined(STLSOFT_COMPILER_IS_BORLAND)
  320. static const value_type minimum_value = STLSOFT_LIMIT_TRAITS__UINT64_MIN;
  321. static const value_type maximum_value = STLSOFT_LIMIT_TRAITS__UINT64_MAX;
  322. # endif /* STLSOFT_CF_MEMBER_CONSTANT_SUPPORT */
  323. };
  324. #endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
  325. # endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  326. #ifdef STLSOFT_CF_CHAR_DISTINCT_INT_TYPE
  327. STLSOFT_TEMPLATE_SPECIALISATION
  328. struct limit_traits<signed char>
  329. : limit_traits_fixed<ss_sint8_t>
  330. {};
  331. STLSOFT_TEMPLATE_SPECIALISATION
  332. struct limit_traits<unsigned char>
  333. : limit_traits_fixed<ss_uint8_t>
  334. {};
  335. #endif /* STLSOFT_CF_CHAR_DISTINCT_INT_TYPE */
  336. STLSOFT_TEMPLATE_SPECIALISATION
  337. struct limit_traits<char>
  338. #ifdef STLSOFT_CF_CHAR_IS_UNSIGNED
  339. : limit_traits_fixed<ss_uint8_t>
  340. #else /* ? STLSOFT_CF_CHAR_IS_UNSIGNED */
  341. : limit_traits_fixed<ss_sint8_t>
  342. #endif /* STLSOFT_CF_CHAR_IS_UNSIGNED */
  343. {};
  344. STLSOFT_TEMPLATE_SPECIALISATION
  345. struct limit_traits<ss_sint8_t>
  346. : limit_traits_fixed<ss_sint8_t>
  347. {};
  348. STLSOFT_TEMPLATE_SPECIALISATION
  349. struct limit_traits<ss_uint8_t>
  350. : limit_traits_fixed<ss_uint8_t>
  351. {};
  352. STLSOFT_TEMPLATE_SPECIALISATION
  353. struct limit_traits<ss_sint16_t>
  354. : limit_traits_fixed<ss_sint16_t>
  355. {};
  356. STLSOFT_TEMPLATE_SPECIALISATION
  357. struct limit_traits<ss_uint16_t>
  358. : limit_traits_fixed<ss_uint16_t>
  359. {};
  360. STLSOFT_TEMPLATE_SPECIALISATION
  361. struct limit_traits<ss_sint32_t>
  362. : limit_traits_fixed<ss_sint32_t>
  363. {};
  364. STLSOFT_TEMPLATE_SPECIALISATION
  365. struct limit_traits<ss_uint32_t>
  366. : limit_traits_fixed<ss_uint32_t>
  367. {};
  368. #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
  369. STLSOFT_TEMPLATE_SPECIALISATION
  370. struct limit_traits<ss_sint64_t>
  371. : limit_traits_fixed<ss_sint64_t>
  372. {};
  373. STLSOFT_TEMPLATE_SPECIALISATION
  374. struct limit_traits<ss_uint64_t>
  375. : limit_traits_fixed<ss_uint64_t>
  376. {};
  377. #endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
  378. #ifdef STLSOFT_CF_SHORT_DISTINCT_INT_TYPE
  379. STLSOFT_TEMPLATE_SPECIALISATION
  380. struct limit_traits<short>
  381. : limit_traits_fixed<int_size_traits<sizeof(short)>::signed_type>
  382. {};
  383. STLSOFT_TEMPLATE_SPECIALISATION
  384. struct limit_traits<unsigned short>
  385. : limit_traits_fixed<int_size_traits<sizeof(unsigned short)>::unsigned_type>
  386. {};
  387. #endif /* STLSOFT_CF_SHORT_DISTINCT_INT_TYPE */
  388. #ifdef STLSOFT_CF_INT_DISTINCT_INT_TYPE
  389. STLSOFT_TEMPLATE_SPECIALISATION
  390. struct limit_traits<int>
  391. : limit_traits_fixed<int_size_traits<sizeof(int)>::signed_type>
  392. {};
  393. STLSOFT_TEMPLATE_SPECIALISATION
  394. struct limit_traits<unsigned int>
  395. : limit_traits_fixed<int_size_traits<sizeof(unsigned int)>::unsigned_type>
  396. {};
  397. #endif /* STLSOFT_CF_INT_DISTINCT_INT_TYPE */
  398. #ifdef STLSOFT_CF_LONG_DISTINCT_INT_TYPE
  399. STLSOFT_TEMPLATE_SPECIALISATION
  400. struct limit_traits<long>
  401. : limit_traits_fixed<int_size_traits<sizeof(long)>::signed_type>
  402. {};
  403. STLSOFT_TEMPLATE_SPECIALISATION
  404. struct limit_traits<unsigned long>
  405. : limit_traits_fixed<int_size_traits<sizeof(unsigned long)>::unsigned_type>
  406. {};
  407. #endif /* STLSOFT_CF_LONG_DISTINCT_INT_TYPE */
  408. # endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  409. #endif /* __cplusplus */
  410. /* /////////////////////////////////////////////////////////////////////////
  411. * Unit-testing
  412. */
  413. #ifdef STLSOFT_UNITTEST
  414. # include "./unittest/limit_traits_unittest_.h"
  415. #endif /* STLSOFT_UNITTEST */
  416. /* ////////////////////////////////////////////////////////////////////// */
  417. #ifndef _STLSOFT_NO_NAMESPACE
  418. } /* namespace stlsoft */
  419. #endif /* _STLSOFT_NO_NAMESPACE */
  420. /* ////////////////////////////////////////////////////////////////////// */
  421. #endif /* !STLSOFT_INCL_STLSOFT_UTIL_H_LIMIT_TRAITS */
  422. /* ///////////////////////////// end of file //////////////////////////// */