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.

3126 lines
121 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: stlsoft/stlsoft.h
  3. *
  4. * Purpose: Root header for the STLSoft libraries. Performs various
  5. * compiler and platform discriminations, and definitions of
  6. * types.
  7. *
  8. * Created: 15th January 2002
  9. * Updated: 18th August 2012
  10. *
  11. * Home: http://stlsoft.org/
  12. *
  13. * Copyright (c) 2002-2012, Matthew Wilson and Synesis Software
  14. * All rights reserved.
  15. *
  16. * Redistribution and use in source and binary forms, with or without
  17. * modification, are permitted provided that the following conditions are
  18. * met:
  19. *
  20. * - Redistributions of source code must retain the above copyright notice,
  21. * this list of conditions and the following disclaimer.
  22. * - Redistributions in binary form must reproduce the above copyright
  23. * notice, this list of conditions and the following disclaimer in the
  24. * documentation and/or other materials provided with the distribution.
  25. * - Neither the name(s) of Matthew Wilson and Synesis Software nor the
  26. * names of any contributors may be used to endorse or promote products
  27. * derived from this software without specific prior written permission.
  28. *
  29. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  30. * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  31. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  32. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  33. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  34. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  35. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  36. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  37. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  38. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  39. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. *
  41. * ////////////////////////////////////////////////////////////////////// */
  42. #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
  43. #define STLSOFT_INCL_STLSOFT_H_STLSOFT
  44. #define STLSOFT_INCL_H_STLSOFT /*!< \brief Definition of previous include-guard symbol for stlsoft/stlsoft.h, for backwards compatibility. */
  45. #if defined(__STLSOFT_DOCUMENTATION_SKIP_SECTION) && \
  46. !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  47. # define STLSOFT_DOCUMENTATION_SKIP_SECTION
  48. #endif /* STLSOFT_DOCUMENTATION_SKIP_SECTION? */
  49. /* File version */
  50. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  51. # define STLSOFT_VER_STLSOFT_H_STLSOFT_MAJOR 3
  52. # define STLSOFT_VER_STLSOFT_H_STLSOFT_MINOR 28
  53. # define STLSOFT_VER_STLSOFT_H_STLSOFT_REVISION 2
  54. # define STLSOFT_VER_STLSOFT_H_STLSOFT_EDIT 431
  55. #else /* ? STLSOFT_DOCUMENTATION_SKIP_SECTION */
  56. /* # include "./internal/doxygen_defs.h" */
  57. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  58. /** \file stlsoft/stlsoft.h
  59. *
  60. * \brief [C, C++] The root header for the
  61. * \ref group__project__stlsoft "STLSoft" project, and for all other
  62. * \ref group__projects "projects".
  63. */
  64. /* /////////////////////////////////////////////////////////////////////////
  65. * STLSoft version
  66. *
  67. * The libraries version information is comprised of major, minor and
  68. * revision components.
  69. *
  70. * Each release of the libraries will bear a different version, and that
  71. * version will also have its own symbol: Version 1.0.1 specifies
  72. * _STLSOFT_VER_1_0_1.
  73. *
  74. * Thus the symbol _STLSOFT_VER may be compared meaningfully with a specific
  75. * version symbol, e.g.# if _STLSOFT_VER >= _STLSOFT_VER_1_0_1
  76. */
  77. /** \def _STLSOFT_VER_MAJOR
  78. * \brief The major version number of STLSoft
  79. *
  80. * A change to the major version component implies that a dramatic change
  81. * has occurred in the libraries, such that considerable changes to source
  82. * dependent on previous versions would need to be effected.
  83. */
  84. /** \def _STLSOFT_VER_MINOR
  85. * \brief The minor version number of STLSoft
  86. *
  87. * A change to the minor version component imply that a significant change
  88. * has occurred to the libraries, either in the addition of new functionality
  89. * or in the destructive change to one or more components such that
  90. * recompilation and code change may be necessitated.
  91. */
  92. /** \def _STLSOFT_VER_REVISION
  93. * \brief The revision version number of STLSoft
  94. *
  95. * A change to the revision version component imply that a bug has been
  96. * fixed. Dependent code should be recompiled in order to pick up the
  97. * changes.
  98. */
  99. /** \def _STLSOFT_VER
  100. * \brief The current composite version number of STLSoft
  101. *
  102. * In addition to the individual version symbols - _STLSOFT_VER_MAJOR,
  103. * _STLSOFT_VER_MINOR and _STLSOFT_VER_REVISION - a composite symbol
  104. * _STLSOFT_VER is defined, where:
  105. * - bits 24-31: the major version
  106. * - bits 16-23: the minor version
  107. * - bits 8-15: the revision version
  108. * - bits 0-7: the beta number; if not a beta, it is 0xFF
  109. */
  110. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  111. # define _STLSOFT_VER_1_0_1 0x00010001 /*!< Version 1.0.1 */
  112. # define _STLSOFT_VER_1_0_2 0x00010002 /*!< Version 1.0.2 */
  113. # define _STLSOFT_VER_1_1_1 0x00010101 /*!< Version 1.1.1 */
  114. # define _STLSOFT_VER_1_1_2 0x00010102 /*!< Version 1.1.2 */
  115. # define _STLSOFT_VER_1_1_3 0x00010103 /*!< Version 1.1.3 */
  116. # define _STLSOFT_VER_1_2_1 0x00010201 /*!< Version 1.2.1 */
  117. # define _STLSOFT_VER_1_3_1 0x00010301 /*!< Version 1.3.1 */
  118. # define _STLSOFT_VER_1_3_2 0x00010302 /*!< Version 1.3.2 */
  119. # define _STLSOFT_VER_1_4_1 0x00010401 /*!< Version 1.4.1 */
  120. # define _STLSOFT_VER_1_4_2 0x00010402 /*!< Version 1.4.2 */
  121. # define _STLSOFT_VER_1_4_3 0x00010403 /*!< Version 1.4.3 */
  122. # define _STLSOFT_VER_1_4_4 0x00010404 /*!< Version 1.4.4 */
  123. # define _STLSOFT_VER_1_4_5 0x00010405 /*!< Version 1.4.5 */
  124. # define _STLSOFT_VER_1_4_6 0x00010406 /*!< Version 1.4.6 */
  125. # define _STLSOFT_VER_1_5_1 0x00010501 /*!< Version 1.5.1 */
  126. # define _STLSOFT_VER_1_5_2 0x00010502 /*!< Version 1.5.2 */
  127. # define _STLSOFT_VER_1_6_1 0x00010601 /*!< Version 1.6.1 */
  128. # define _STLSOFT_VER_1_6_2 0x00010602 /*!< Version 1.6.2 */
  129. # define _STLSOFT_VER_1_6_3 0x00010603 /*!< Version 1.6.3 */
  130. # define _STLSOFT_VER_1_6_4 0x00010604 /*!< Version 1.6.4 */
  131. # define _STLSOFT_VER_1_6_5 0x00010605 /*!< Version 1.6.5 */
  132. # define _STLSOFT_VER_1_6_6 0x00010606 /*!< Version 1.6.6 */
  133. # define _STLSOFT_VER_1_7_1 0x00010701 /*!< Version 1.7.1 */
  134. # define _STLSOFT_VER_1_7_2 0x00010702 /*!< Version 1.7.2 */
  135. # define _STLSOFT_VER_1_8_1 0x00010801 /*!< Version 1.8.1 */
  136. # define _STLSOFT_VER_1_8_2 0x00010802 /*!< Version 1.8.2 */
  137. # define _STLSOFT_VER_1_8_3 0x00010803 /*!< Version 1.8.3 */
  138. # define _STLSOFT_VER_1_8_4 0x00010804 /*!< Version 1.8.4 */
  139. # define _STLSOFT_VER_1_8_5 0x00010805 /*!< Version 1.8.5 */
  140. # define _STLSOFT_VER_1_8_6 0x00010806 /*!< Version 1.8.6 */
  141. # define _STLSOFT_VER_1_8_7 0x00010807 /*!< Version 1.8.7 */
  142. # define _STLSOFT_VER_1_8_8 0x00010808 /*!< Version 1.8.8 */
  143. # define _STLSOFT_VER_1_8_9 0x00010809 /*!< Version 1.8.9 */
  144. # define _STLSOFT_VER_1_9_1_B13 0x0109010d /*!< Version 1.9.1 beta 13 (10th Jul 2006) */
  145. # define _STLSOFT_VER_1_9_1_B20 0x01090114 /*!< Version 1.9.1 beta 20 (28th Aug 2006) */
  146. # define _STLSOFT_VER_1_9_1_B22 0x01090116 /*!< Version 1.9.1 beta 22 (13th Sep 2006) */
  147. # define _STLSOFT_VER_1_9_1_B28 0x0109011c /*!< Version 1.9.1 beta 28 (29th Oct 2006) */
  148. # define _STLSOFT_VER_1_9_1_B29 0x0109011d /*!< Version 1.9.1 beta 29 (27th Nov 2006) */
  149. # define _STLSOFT_VER_1_9_1_B33 0x01090121 /*!< Version 1.9.1 beta 33 (13th Dec 2006) */
  150. # define _STLSOFT_VER_1_9_1_B34 0x01090122 /*!< Version 1.9.1 beta 34 (24th Dec 2006) */
  151. # define _STLSOFT_VER_1_9_1_B37 0x01090125 /*!< Version 1.9.1 beta 37 (30th Dec 2006) */
  152. # define _STLSOFT_VER_1_9_1_B40 0x01090128 /*!< Version 1.9.1 beta 40 (6th Jan 2007) */
  153. # define _STLSOFT_VER_1_9_1_B41 0x01090129 /*!< Version 1.9.1 beta 41 (14th Jan 2007) */
  154. # define _STLSOFT_VER_1_9_1_B42 0x0109012a /*!< Version 1.9.1 beta 42 (15th Jan 2007) */
  155. # define _STLSOFT_VER_1_9_1_B45 0x0109012d /*!< Version 1.9.1 beta 45 (1st Mar 2007) */
  156. # define _STLSOFT_VER_1_9_1_B47 0x0109012f /*!< Version 1.9.1 beta 47 (6th Apr 2007) */
  157. # define _STLSOFT_VER_1_9_1_B48 0x01090130 /*!< Version 1.9.1 beta 48 (12th Apr 2007) */
  158. # define _STLSOFT_VER_1_9_1 0x010901ff /*!< Version 1.9.1 (30th Apr 2007) */
  159. # define _STLSOFT_VER_1_9_2 0x010902ff /*!< Version 1.9.2 (2nd Jun 2007) */
  160. # define _STLSOFT_VER_1_9_3 0x010903ff /*!< Version 1.9.3 (29th Jul 2007) */
  161. # define _STLSOFT_VER_1_9_4 0x010904ff /*!< Version 1.9.4 (2nd Aug 2007) */
  162. # define _STLSOFT_VER_1_9_5 0x010905ff /*!< Version 1.9.5 (4th Aug 2007) */
  163. # define _STLSOFT_VER_1_9_6 0x010906ff /*!< Version 1.9.6 (6th Aug 2007) */
  164. # define _STLSOFT_VER_1_9_7 0x010907ff /*!< Version 1.9.7 (16th Nov 2007) */
  165. # define _STLSOFT_VER_1_9_8 0x010908ff /*!< Version 1.9.8 (18th Nov 2007) */
  166. # define _STLSOFT_VER_1_9_9 0x010909ff /*!< Version 1.9.9 (19th Nov 2007) */
  167. # define _STLSOFT_VER_1_9_10 0x01090aff /*!< Version 1.9.10 (10th Dec 2007) */
  168. # define _STLSOFT_VER_1_9_11 0x01090bff /*!< Version 1.9.11 (17th Dec 2007) */
  169. # define _STLSOFT_VER_1_9_12 0x01090cff /*!< Version 1.9.12 (19th Dec 2007) */
  170. # define _STLSOFT_VER_1_9_13 0x01090dff /*!< Version 1.9.13 (20th Dec 2007) */
  171. # define _STLSOFT_VER_1_9_14 0x01090eff /*!< Version 1.9.14 (23rd Dec 2007) */
  172. # define _STLSOFT_VER_1_9_15 0x01090fff /*!< Version 1.9.15 (24th Dec 2007) */
  173. # define _STLSOFT_VER_1_9_16 0x010910ff /*!< Version 1.9.16 (29th Dec 2007) */
  174. # define _STLSOFT_VER_1_9_17 0x010911ff /*!< Version 1.9.17 (5th Jan 2008) */
  175. # define _STLSOFT_VER_1_9_18 0x010912ff /*!< Version 1.9.18 (27th Jan 2008) */
  176. # define _STLSOFT_VER_1_9_19 0x010913ff /*!< Version 1.9.19 (2nd Feb 2008) */
  177. # define _STLSOFT_VER_1_9_20 0x010914ff /*!< Version 1.9.20 (3rd Feb 2008) */
  178. # define _STLSOFT_VER_1_9_21 0x010915ff /*!< Version 1.9.21 (5th Feb 2008) */
  179. # define _STLSOFT_VER_1_9_22 0x010916ff /*!< Version 1.9.22 (8th Feb 2008) */
  180. # define _STLSOFT_VER_1_9_23 0x010917ff /*!< Version 1.9.23 (21st Feb 2008) */
  181. # define _STLSOFT_VER_1_9_24 0x010918ff /*!< Version 1.9.24 (8th Mar 2008) */
  182. # define _STLSOFT_VER_1_9_25 0x010919ff /*!< Version 1.9.25 (9th Mar 2008) */
  183. # define _STLSOFT_VER_1_9_26 0x01091aff /*!< Version 1.9.26 (15th Mar 2008) */
  184. # define _STLSOFT_VER_1_9_27 0x01091bff /*!< Version 1.9.27 (17th Mar 2008) */
  185. # define _STLSOFT_VER_1_9_28 0x01091cff /*!< Version 1.9.28 (24th Mar 2008) */
  186. # define _STLSOFT_VER_1_9_29 0x01091dff /*!< Version 1.9.29 (3rd Apr 2008) */
  187. # define _STLSOFT_VER_1_9_30 0x01091eff /*!< Version 1.9.30 (3rd Apr 2008) */
  188. # define _STLSOFT_VER_1_9_31 0x01091fff /*!< Version 1.9.31 (13th Apr 2008) */
  189. # define _STLSOFT_VER_1_9_32 0x010920ff /*!< Version 1.9.32 (22nd Apr 2008) */
  190. # define _STLSOFT_VER_1_9_33 0x010921ff /*!< Version 1.9.33 (24th Apr 2008) */
  191. # define _STLSOFT_VER_1_9_34 0x010922ff /*!< Version 1.9.34 (25th Apr 2008) */
  192. # define _STLSOFT_VER_1_9_35 0x010923ff /*!< Version 1.9.35 (29th Apr 2008) */
  193. # define _STLSOFT_VER_1_9_36 0x010924ff /*!< Version 1.9.36 (30th Apr 2008) */
  194. # define _STLSOFT_VER_1_9_37 0x010925ff /*!< Version 1.9.37 (3rd May 2008) */
  195. # define _STLSOFT_VER_1_9_38 0x010926ff /*!< Version 1.9.38 (4th May 2008) */
  196. # define _STLSOFT_VER_1_9_39 0x010927ff /*!< Version 1.9.39 (10th May 2008) */
  197. # define _STLSOFT_VER_1_9_40 0x010928ff /*!< Version 1.9.40 (13th May 2008) */
  198. # define _STLSOFT_VER_1_9_41 0x010929ff /*!< Version 1.9.41 (14th May 2008) */
  199. # define _STLSOFT_VER_1_9_42 0x01092aff /*!< Version 1.9.42 (17th May 2008) */
  200. # define _STLSOFT_VER_1_9_43 0x01092bff /*!< Version 1.9.43 (31st May 2008) */
  201. # define _STLSOFT_VER_1_9_44 0x01092cff /*!< Version 1.9.44 (1st Jun 2008) */
  202. # define _STLSOFT_VER_1_9_45 0x01092dff /*!< Version 1.9.45 (8th Jun 2008) */
  203. # define _STLSOFT_VER_1_9_46 0x01092eff /*!< Version 1.9.46 (11th Aug 2008) */
  204. # define _STLSOFT_VER_1_9_48 0x010930ff /*!< Version 1.9.48 (23rd Aug 2008) */
  205. # define _STLSOFT_VER_1_9_49 0x010931ff /*!< Version 1.9.49 (2nd Sep 2008) */
  206. # define _STLSOFT_VER_1_9_50 0x010932ff /*!< Version 1.9.50 (3rd Sep 2008) */
  207. # define _STLSOFT_VER_1_9_51 0x010933ff /*!< Version 1.9.51 (6th Sep 2008) */
  208. # define _STLSOFT_VER_1_9_52 0x010934ff /*!< Version 1.9.52 (11th Sep 2008) */
  209. # define _STLSOFT_VER_1_9_53 0x010935ff /*!< Version 1.9.53 (15th Sep 2008) */
  210. # define _STLSOFT_VER_1_9_54 0x010936ff /*!< Version 1.9.54 (15th Sep 2008) */
  211. # define _STLSOFT_VER_1_9_55 0x010937ff /*!< Version 1.9.55 (23rd Sep 2008) */
  212. # define _STLSOFT_VER_1_9_56 0x010938ff /*!< Version 1.9.56 (1st Oct 2008) */
  213. # define _STLSOFT_VER_1_9_57 0x010939ff /*!< Version 1.9.57 (10th Oct 2008) */
  214. # define _STLSOFT_VER_1_9_58 0x01093aff /*!< Version 1.9.58 (15th Oct 2008) */
  215. # define _STLSOFT_VER_1_9_59 0x01093bff /*!< Version 1.9.59 (24th Oct 2008) */
  216. # define _STLSOFT_VER_1_9_60 0x01093cff /*!< Version 1.9.60 (27th Oct 2008) */
  217. # define _STLSOFT_VER_1_9_62 0x01093eff /*!< Version 1.9.62 (1st Dec 2008) */
  218. # define _STLSOFT_VER_1_9_63 0x01093fff /*!< Version 1.9.63 (9th Dec 2008) */
  219. # define _STLSOFT_VER_1_9_64 0x010940ff /*!< Version 1.9.64 (28th Dec 2008) */
  220. # define _STLSOFT_VER_1_9_65 0x010941ff /*!< Version 1.9.65 (1st Jan 2009) */
  221. # define _STLSOFT_VER_1_9_66 0x010942ff /*!< Version 1.9.66 (4th Jan 2009) */
  222. # define _STLSOFT_VER_1_9_67 0x010943ff /*!< Version 1.9.67 (17th Jan 2009) */
  223. # define _STLSOFT_VER_1_9_68 0x010944ff /*!< Version 1.9.68 (18th Jan 2009) */
  224. # define _STLSOFT_VER_1_9_69 0x010945ff /*!< Version 1.9.69 (23rd Jan 2009) */
  225. # define _STLSOFT_VER_1_9_70 0x010946ff /*!< Version 1.9.70 (24th Jan 2009) */
  226. # define _STLSOFT_VER_1_9_71 0x010947ff /*!< Version 1.9.71 (28th Jan 2009) */
  227. # define _STLSOFT_VER_1_9_72 0x010948ff /*!< Version 1.9.72 (1st Feb 2009) */
  228. # define _STLSOFT_VER_1_9_73 0x010949ff /*!< Version 1.9.73 (5th Feb 2009) */
  229. # define _STLSOFT_VER_1_9_74 0x01094aff /*!< Version 1.9.74 (6th Feb 2009) */
  230. # define _STLSOFT_VER_1_9_75 0x01094bff /*!< Version 1.9.75 (24th Feb 2009) */
  231. # define _STLSOFT_VER_1_9_76 0x01094cff /*!< Version 1.9.76 (6th Mar 2009) */
  232. # define _STLSOFT_VER_1_9_77 0x01094dff /*!< Version 1.9.77 (9th Mar 2009) */
  233. # define _STLSOFT_VER_1_9_78 0x01094eff /*!< Version 1.9.78 (27th Apr 2009) */
  234. # define _STLSOFT_VER_1_9_79 0x01094fff /*!< Version 1.9.79 (2nd May 2009) */
  235. # define _STLSOFT_VER_1_9_80 0x010950ff /*!< Version 1.9.80 (5th May 2009) */
  236. # define _STLSOFT_VER_1_9_81 0x010951ff /*!< Version 1.9.81 (??? May 2009) */
  237. # define _STLSOFT_VER_1_9_82 0x010952ff /*!< Version 1.9.82 (14th May 2009) */
  238. # define _STLSOFT_VER_1_9_83 0x010953ff /*!< Version 1.9.83 (19th May 2009) */
  239. # define _STLSOFT_VER_1_9_84 0x010954ff /*!< Version 1.9.84 (22nd May 2009) */
  240. # define _STLSOFT_VER_1_9_85 0x010955ff /*!< Version 1.9.85 (16th June 2009) */
  241. # define _STLSOFT_VER_1_9_86 0x010956ff /*!< Version 1.9.86 (21st July 2009) */
  242. # define _STLSOFT_VER_1_9_87 0x010957ff /*!< Version 1.9.87 (10th August 2009) */
  243. # define _STLSOFT_VER_1_9_88 0x010958ff /*!< Version 1.9.88 (12th January 2010) */
  244. # define _STLSOFT_VER_1_9_89 0x010959ff /*!< Version 1.9.89 (19th January 2010) */
  245. # define _STLSOFT_VER_1_9_90 0x01095aff /*!< Version 1.9.90 (21st January 2010) */
  246. # define _STLSOFT_VER_1_9_91 0x01095bff /*!< Version 1.9.91 (30th January 2010) */
  247. # define _STLSOFT_VER_1_9_92 0x01095cff /*!< Version 1.9.92 (11th February 2010) */
  248. # define _STLSOFT_VER_1_9_93 0x01095dff /*!< Version 1.9.93 (14th February 2010) */
  249. # define _STLSOFT_VER_1_9_95 0x01095fff /*!< Version 1.9.95 (7th March 2010) */
  250. # define _STLSOFT_VER_1_9_96 0x010960ff /*!< Version 1.9.96 (10th March 2010) */
  251. # define _STLSOFT_VER_1_9_97 0x010961ff /*!< Version 1.9.97 (3rd April 2010) */
  252. # define _STLSOFT_VER_1_9_98 0x010962ff /*!< Version 1.9.98 (7th June 2010) */
  253. # define _STLSOFT_VER_1_9_99 0x010963ff /*!< Version 1.9.99 (21st June 2010) */
  254. # define _STLSOFT_VER_1_9_100 0x010964ff /*!< Version 1.9.100 (29th July 2010) */
  255. # define _STLSOFT_VER_1_9_101 0x010965ff /*!< Version 1.9.101 (30th September 2010) */
  256. # define _STLSOFT_VER_1_9_102 0x010966ff /*!< Version 1.9.102 (8th November 2010) */
  257. # define _STLSOFT_VER_1_9_103 0x010967ff /*!< Version 1.9.103 (20th November 2010) */
  258. # define _STLSOFT_VER_1_9_104 0x010968ff /*!< Version 1.9.104 (22nd November 2010) */
  259. # define _STLSOFT_VER_1_9_105 0x010969ff /*!< Version 1.9.105 (22nd December 2010) */
  260. # define _STLSOFT_VER_1_9_106 0x01096aff /*!< Version 1.9.106 (28th December 2010) */
  261. # define _STLSOFT_VER_1_9_107 0x01096bff /*!< Version 1.9.107 (30th January 2011) */
  262. # define _STLSOFT_VER_1_9_108 0x01096cff /*!< Version 1.9.108 (31st January 2011) */
  263. # define _STLSOFT_VER_1_9_109 0x01096dff /*!< Version 1.9.109 (17th February 2011) */
  264. # define _STLSOFT_VER_1_9_110 0x01096eff /*!< Version 1.9.110 (25th November 2011) */
  265. # define _STLSOFT_VER_1_9_111 0x01096fff /*!< Version 1.9.111 (30th November 2011) */
  266. # define _STLSOFT_VER_1_9_112 0x010970ff /*!< Version 1.9.112 (7th February 2012) */
  267. # define _STLSOFT_VER_1_9_113 0x010971ff /*!< Version 1.9.113 (4th June 2012) */
  268. # define _STLSOFT_VER_1_9_114 0x010972ff /*!< Version 1.9.114 (4th June 2012) */
  269. # define _STLSOFT_VER_1_9_115 0x010973ff /*!< Version 1.9.115 (30th July 2012) */
  270. # define _STLSOFT_VER_1_9_116 0x010974ff /*!< Version 1.9.116 (18th August 2012) */
  271. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  272. #define _STLSOFT_VER_MAJOR 1
  273. #define _STLSOFT_VER_MINOR 9
  274. #define _STLSOFT_VER_REVISION 116
  275. #define _STLSOFT_VER _STLSOFT_VER_1_9_116
  276. /* /////////////////////////////////////
  277. * Underlying version detection
  278. */
  279. /* defines STLSOFT_HEAD_VER, which specifies the current version of the
  280. * main (HEAD) library. Will never be greater than STLSOFT_LEAD_VER.
  281. */
  282. #include <stlsoft/internal/head_version.h>
  283. /* defines STLSOFT_LEAD_VER, which specifies the current version of any
  284. * alpha (LEAD) library. Will never be less than STLSOFT_HEAD_VER.
  285. */
  286. #include <stlsoft/internal/lead_version.h>
  287. /* /////////////////////////////////////////////////////////////////////////
  288. * Basic macros
  289. */
  290. /* Compilation messages
  291. *
  292. * To see certain informational messages during compilation define the
  293. * preprocessor symbol STLSOFT_COMPILE_VERBOSE
  294. */
  295. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  296. # define STLSOFT_STRINGIZE_a_(x) #x
  297. # define STLSOFT_STRINGIZE_a(x) STLSOFT_STRINGIZE_a_(x)
  298. # if defined(__BORLANDC__) || \
  299. defined(__SUNPRO_C)
  300. # define STLSOFT_STRINGIZE_w_(x) L"" ## STLSOFT_STRINGIZE_a(x)
  301. # else /* ? compiler */
  302. # define STLSOFT_STRINGIZE_w_(x) L ## #x
  303. # endif /* compiler */
  304. # define STLSOFT_STRINGIZE_w(x) STLSOFT_STRINGIZE_w_(x)
  305. # define STLSOFT_STRINGIZE(x) STLSOFT_STRINGIZE_a(x)
  306. /* Simple macro indirection */
  307. # define STLSOFT_MACRO_INDIRECT(x) x
  308. /* Token pasting */
  309. # define STLSOFT_PP_PASTE_2_TOKENS(t1, t2) t1 ## t2
  310. # define STLSOFT_PP_PASTE_3_TOKENS(t1, t2, t3) t1 ## t2 ## t3
  311. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  312. /* /////////////////////////////////////////////////////////////////////////
  313. * Sanity checks - 1
  314. */
  315. /* /////////////////////////////////////////////////////////////////////////
  316. * Compiler compatibility
  317. *
  318. * Currently the only compilers supported by the STLSoft libraries are
  319. *
  320. * Borland C++ 5.5, 5.51, 5.6 & 5.6.4
  321. * Comeau 4.3.0.1 & 4.3.3
  322. * Digital Mars C/C++ 8.26 and above
  323. * GCC 2.95, 2.96, 3.2, 3.3, 3.4 & 4.0
  324. * Intel C/C++ 6.0, 7.0, 7.1, 8.0, 9.0
  325. * Metrowerks 2.4 & 3.0 (CodeWarrior 7.0 & 8.0)
  326. * SunPro 5.9
  327. * Visual C++ 4.2, 5.0, 6.0, 7.0 (.NET), 7.1 (.NET 2003), 8.0
  328. * Watcom C/C++ 11.0, Open Watcom 1.0, 1.1, 1.2, 1.3, 1.4, 1.5
  329. */
  330. #ifdef STLSOFT_COMPILER_IS_UNKNOWN
  331. # undef STLSOFT_COMPILER_IS_UNKNOWN
  332. #endif /* STLSOFT_COMPILER_IS_UNKNOWN */
  333. #ifdef STLSOFT_COMPILER_IS_BORLAND
  334. # undef STLSOFT_COMPILER_IS_BORLAND
  335. #endif /* STLSOFT_COMPILER_IS_BORLAND */
  336. #ifdef STLSOFT_COMPILER_IS_COMO
  337. # undef STLSOFT_COMPILER_IS_COMO
  338. #endif /* STLSOFT_COMPILER_IS_COMO */
  339. #ifdef STLSOFT_COMPILER_IS_DMC
  340. # undef STLSOFT_COMPILER_IS_DMC
  341. #endif /* STLSOFT_COMPILER_IS_DMC */
  342. #ifdef STLSOFT_COMPILER_IS_GCC
  343. # undef STLSOFT_COMPILER_IS_GCC
  344. #endif /* STLSOFT_COMPILER_IS_GCC */
  345. #ifdef STLSOFT_COMPILER_IS_INTEL
  346. # undef STLSOFT_COMPILER_IS_INTEL
  347. #endif /* STLSOFT_COMPILER_IS_INTEL */
  348. #ifdef STLSOFT_COMPILER_IS_MSVC
  349. # undef STLSOFT_COMPILER_IS_MSVC
  350. #endif /* STLSOFT_COMPILER_IS_MSVC */
  351. #ifdef STLSOFT_COMPILER_IS_MWERKS
  352. # undef STLSOFT_COMPILER_IS_MWERKS
  353. #endif /* STLSOFT_COMPILER_IS_MWERKS */
  354. #ifdef STLSOFT_COMPILER_IS_SUNPRO
  355. # undef STLSOFT_COMPILER_IS_SUNPRO
  356. #endif /* STLSOFT_COMPILER_IS_SUNPRO */
  357. #ifdef STLSOFT_COMPILER_IS_VECTORC
  358. # undef STLSOFT_COMPILER_IS_VECTORC
  359. #endif /* STLSOFT_COMPILER_IS_VECTORC */
  360. #ifdef STLSOFT_COMPILER_IS_WATCOM
  361. # undef STLSOFT_COMPILER_IS_WATCOM
  362. #endif /* STLSOFT_COMPILER_IS_WATCOM */
  363. /* Strict compability fix
  364. */
  365. #if defined(_STLSOFT_STRICT) && \
  366. !defined(STLSOFT_STRICT)
  367. # define STLSOFT_STRICT
  368. #endif /* _STLSOFT_STRICT && !STLSOFT_STRICT */
  369. /* First we do a check to see whether other compilers are providing
  370. * compatibility with Visual C++, and handle that.
  371. */
  372. #ifdef _MSC_VER
  373. # if defined(__BORLANDC__) || /* Borland */ \
  374. defined(__COMO__) || /* Comeau */ \
  375. defined(__DMC__) || /* Digital Mars */ \
  376. defined(__GNUC__) || /* GNU */ \
  377. defined(__INTEL_COMPILER) || /* Intel */ \
  378. defined(__MWERKS__) || /* Metrowerks */ \
  379. defined(__SUNPRO_C) || /* Sun Pro C */ \
  380. defined(__SUNPRO_CC) || /* Sun Pro C++ */ \
  381. defined(__VECTORC) || /* VectorC */ \
  382. defined(__WATCOMC__) /* Watcom */
  383. /* Handle Microsoft Visual C++ support. */
  384. # if defined(_STLSOFT_NO_MSC_VER_SUPPORT) || \
  385. ( defined(STLSOFT_STRICT) && \
  386. !defined(_STLSOFT_MSC_VER_SUPPORT))
  387. # undef _MSC_VER
  388. # endif /* _STLSOFT_NO_MSC_VER_SUPPORT || (STLSOFT_STRICT && _STLSOFT_MSC_VER_SUPPORT) */
  389. # endif /* compiler */
  390. #endif /* _MSC_VER */
  391. #if defined(_STLSOFT_FORCE_CUSTOM_COMPILER)
  392. # define STLSOFT_COMPILER_LABEL_STRING "Custom (forced) compiler"
  393. # define STLSOFT_COMPILER_VERSION_STRING "Custom (forced) compiler"
  394. # define STLSOFT_COMPILER_IS_CUSTOM
  395. # ifndef __STLSOFT_CF_CUSTOM_COMPILER_INCLUDE_NAME
  396. # error When using the custom compiler option you must define the symbol __STLSOFT_CF_CUSTOM_COMPILER_INCLUDE_NAME, e.g. #define __STLSOFT_CF_CUSTOM_COMPILER_INCLUDE_NAME <stlsoft/internal/cccap/my_compiler.h>
  397. # endif /* !__STLSOFT_CF_CUSTOM_COMPILER_INCLUDE_NAME */
  398. #elif defined(__COMO__) /* Do Comeau next, so that no Comeau back-end server compilers are preferentially discriminated */
  399. /* ******************************* Comeau ****************************** */
  400. # define STLSOFT_COMPILER_IS_COMO
  401. # define STLSOFT_COMPILER_LABEL_STRING "Comeau C++"
  402. # if __COMO_VERSION__ < 4300
  403. # error Only versions 4.3.0.1 and later of Comeau C++ compiler is supported by the STLSoft libraries
  404. # elif (__COMO_VERSION__ == 4300)
  405. # define STLSOFT_COMPILER_VERSION_STRING "Comeau C++ 4.3.0.1"
  406. # elif (__COMO_VERSION__ == 4303)
  407. # define STLSOFT_COMPILER_VERSION_STRING "Comeau C++ 4.3.3"
  408. # else /* ? __COMO_VERSION__ */
  409. # define STLSOFT_COMPILER_VERSION_STRING "Unknown version of Comeau C++"
  410. # endif /* __COMO_VERSION__ */
  411. #elif defined(__BORLANDC__)
  412. /* ******************************* Borland ***************************** */
  413. # define STLSOFT_COMPILER_IS_BORLAND
  414. # define STLSOFT_COMPILER_LABEL_STRING "Borland C/C++"
  415. # if 0 /* (__BORLANDC__ == 0x0460) */
  416. # define STLSOFT_COMPILER_VERSION_STRING "Borland C++ 4.52"
  417. # elif 0 /* (__BORLANDC__ == 0x0550) */
  418. # define STLSOFT_COMPILER_VERSION_STRING "Borland C++ 5.5"
  419. # elif (__BORLANDC__ == 0x0551)
  420. # define STLSOFT_COMPILER_VERSION_STRING "Borland C++ 5.51"
  421. # elif (__BORLANDC__ == 0x0560)
  422. # define STLSOFT_COMPILER_VERSION_STRING "Borland C++ 5.6"
  423. # elif (__BORLANDC__ == 0x0564)
  424. # define STLSOFT_COMPILER_VERSION_STRING "Borland C++ 5.6.4 (C++ BuilderX)"
  425. # elif (__BORLANDC__ == 0x0582)
  426. # define STLSOFT_COMPILER_VERSION_STRING "Borland C++ 5.82 (Turbo C++)"
  427. # elif (0x0590 == (__BORLANDC__ & 0xfff0))
  428. # define STLSOFT_COMPILER_VERSION_STRING "Borland C++ 5.9.x"
  429. # elif (0x0610 == (__BORLANDC__ & 0xfff0))
  430. # define STLSOFT_COMPILER_VERSION_STRING "Borland C++ 6.1.x (C++ Builder)"
  431. # else /* ? __BORLANDC__ */
  432. # error Currently only versions 5.51, 5.6, 5.6.4, 5.8.2, 5.9.x, and 6.1.x of the Borland C++ compiler are supported by the STLSoft libraries
  433. # endif /* __BORLANDC__ */
  434. #elif defined(__DMC__)
  435. /* **************************** Digital Mars *************************** */
  436. # define STLSOFT_COMPILER_IS_DMC
  437. # define STLSOFT_COMPILER_LABEL_STRING "Digital Mars C/C++"
  438. # if (__DMC__ < 0x0826)
  439. # error Only versions 8.26 and later of the Digital Mars C/C++ compilers are supported by the STLSoft libraries
  440. # else /* ? __DMC__ */
  441. # if __DMC__ >= 0x0832
  442. # define STLSOFT_COMPILER_VERSION_STRING __DMC_VERSION_STRING__
  443. # elif (__DMC__ == 0x0826)
  444. # define STLSOFT_COMPILER_VERSION_STRING "Digital Mars C/C++ 8.26"
  445. # elif (__DMC__ == 0x0827)
  446. # define STLSOFT_COMPILER_VERSION_STRING "Digital Mars C/C++ 8.27"
  447. # elif (__DMC__ == 0x0828)
  448. # define STLSOFT_COMPILER_VERSION_STRING "Digital Mars C/C++ 8.28"
  449. # elif (__DMC__ == 0x0829)
  450. # define STLSOFT_COMPILER_VERSION_STRING "Digital Mars C/C++ 8.29"
  451. # elif (__DMC__ == 0x0830)
  452. # define STLSOFT_COMPILER_VERSION_STRING "Digital Mars C/C++ 8.30"
  453. # elif (__DMC__ == 0x0831)
  454. # define STLSOFT_COMPILER_VERSION_STRING "Digital Mars C/C++ 8.31"
  455. # endif /* __DMC__ */
  456. # endif /* version */
  457. #elif defined(__GNUC__)
  458. /* ******************************** GCC ******************************** */
  459. # define STLSOFT_COMPILER_IS_GCC
  460. # define STLSOFT_COMPILER_LABEL_STRING "GNU C/C++"
  461. # if __GNUC__ != 2 && \
  462. __GNUC__ != 3 && \
  463. __GNUC__ != 4
  464. # error GNU C/C++ compilers whose major version is not 2, 3 or 4 are not currently supported by the STLSoft libraries
  465. # elif __GNUC__ == 2
  466. # if __GNUC_MINOR__ < 95
  467. # error Currently only version 2.95 and above of the GNU C/C++ compiler is supported by the STLSoft libraries
  468. # elif __GNUC_MINOR__ == 95
  469. # define STLSOFT_COMPILER_VERSION_STRING "GNU C/C++ 2.95"
  470. # elif __GNUC_MINOR__ == 96
  471. # define STLSOFT_COMPILER_VERSION_STRING "GNU C/C++ 2.96"
  472. # else /* ? __GNUC_MINOR__ */
  473. # define STLSOFT_COMPILER_VERSION_STRING "GNU C/C++ >2.96 - you should be aware that this version may not be supported correctly"
  474. # endif /* __GNUC_MINOR__ */
  475. # elif __GNUC__ == 3
  476. # if __GNUC_MINOR__ == 2
  477. # define STLSOFT_COMPILER_VERSION_STRING "GNU C/C++ 3.2"
  478. # elif __GNUC_MINOR__ == 3
  479. # define STLSOFT_COMPILER_VERSION_STRING "GNU C/C++ 3.3"
  480. # elif __GNUC_MINOR__ == 4
  481. # define STLSOFT_COMPILER_VERSION_STRING "GNU C/C++ 3.4"
  482. # else /* ? __GNUC_MINOR__ */
  483. # define STLSOFT_COMPILER_VERSION_STRING "GNU C/C++ >3.4 - you should be aware that this version may not be supported correctly"
  484. # endif /* __GNUC_MINOR__ */
  485. # elif __GNUC__ == 0
  486. # if __GNUC_MINOR__ == 0
  487. # define STLSOFT_COMPILER_VERSION_STRING "GNU C/C++ 4.0"
  488. # else /* ? __GNUC_MINOR__ */
  489. # define STLSOFT_COMPILER_VERSION_STRING "GNU C/C++ >4.0 - you should be aware that this version may not be supported correctly"
  490. # endif /* __GNUC__ */
  491. # endif /* __GNUC_MINOR__ */
  492. #elif defined(__INTEL_COMPILER)
  493. /* ******************************* Intel ******************************* */
  494. # define STLSOFT_COMPILER_IS_INTEL
  495. # define STLSOFT_COMPILER_LABEL_STRING "Intel C/C++"
  496. # if (__INTEL_COMPILER == 600)
  497. # define STLSOFT_COMPILER_VERSION_STRING "Intel C/C++ 6.0"
  498. # elif (__INTEL_COMPILER == 700)
  499. # define STLSOFT_COMPILER_VERSION_STRING "Intel C/C++ 7.0"
  500. # elif (__INTEL_COMPILER == 800)
  501. # define STLSOFT_COMPILER_VERSION_STRING "Intel C/C++ 8.0"
  502. # elif (__INTEL_COMPILER == 900)
  503. # define STLSOFT_COMPILER_VERSION_STRING "Intel C/C++ 9.0"
  504. # elif (__INTEL_COMPILER == 1000)
  505. # define STLSOFT_COMPILER_VERSION_STRING "Intel C/C++ 10.0"
  506. # elif (__INTEL_COMPILER == 1100)
  507. # define STLSOFT_COMPILER_VERSION_STRING "Intel C/C++ 11.0"
  508. # elif (__INTEL_COMPILER >= 1200) && (__INTEL_COMPILER < 1300)
  509. # define STLSOFT_COMPILER_VERSION_STRING "Intel C/C++ 12.x"
  510. # elif (__INTEL_COMPILER >= 1300) && (__INTEL_COMPILER < 1400)
  511. # define STLSOFT_COMPILER_VERSION_STRING "Intel C/C++ 13.x"
  512. # else /* ? __INTEL_COMPILER */
  513. # error Only Intel C++ Compiler versions 6.0, 7.0(/7.1), 8.0, 9.0, 10.0, 11.0, 12.x and 13.x currently supported by the STLSoft libraries
  514. # endif /* __INTEL_COMPILER */
  515. #elif defined(__MWERKS__)
  516. /* ***************************** Metrowerks **************************** */
  517. # define STLSOFT_COMPILER_IS_MWERKS
  518. # define STLSOFT_COMPILER_LABEL_STRING "Metrowerks CodeWarrior C/C++"
  519. # if ((__MWERKS__ & 0xFF00) == 0x2400)
  520. # define STLSOFT_COMPILER_VERSION_STRING "Metrowerks CodeWarrior C/C++ 2.4"
  521. # elif ((__MWERKS__ & 0xFF00) == 0x3000)
  522. # define STLSOFT_COMPILER_VERSION_STRING "Metrowerks CodeWarrior C/C++ 3.0"
  523. # elif ((__MWERKS__ & 0xFF00) == 0x3200)
  524. # define STLSOFT_COMPILER_VERSION_STRING "Metrowerks CodeWarrior C/C++ 3.2"
  525. # else /* ? __MWERKS__ */
  526. # error Only Metrowerks C++ Compiler 2.4 (CodeWarrior 7), 3.0 (CodeWarrior 8) and 3.2 (CodeWarrior 9) currently supported by the STLSoft libraries
  527. # endif /* __MWERKS__ */
  528. #elif defined(__SUNPRO_C) || \
  529. defined(__SUNPRO_CC)
  530. /* ******************************* Sun Pro ***************************** */
  531. /* Sanity check on language/compiler */
  532. # ifdef __cplusplus
  533. # ifdef __SUNPRO_C
  534. # error __SUNPRO_C should not be defined by the Sun C compiler in C++ compilation
  535. # endif /* __SUNPRO_C */
  536. # ifndef __SUNPRO_CC
  537. # error __SUNPRO_CC should be defined by the Sun C++ compiler in C++ compilation
  538. # endif /* !__SUNPRO_CC */
  539. # else /* ? __cplusplus */
  540. # ifndef __SUNPRO_C
  541. # error __SUNPRO_C should be defined by the Sun C compiler in C compilation
  542. # endif /* !__SUNPRO_C */
  543. # ifdef __SUNPRO_CC
  544. # error __SUNPRO_CC should not be defined by the Sun C++ compiler in C compilation
  545. # endif /* __SUNPRO_CC */
  546. # endif /* __cplusplus */
  547. # define STLSOFT_COMPILER_IS_SUNPRO
  548. # ifdef __cplusplus
  549. # define STLSOFT_COMPILER_LABEL_STRING "Sun Pro C++"
  550. # if (0x0590 == (__SUNPRO_CC & 0xFFF0))
  551. # define STLSOFT_COMPILER_VERSION_STRING "Sun Pro C++ v5.9"
  552. # else /* ? __SUNPRO_CC */
  553. # error Currently only version v5.9 of the Sun Pro C++ compiler is supported by the STLSoft libraries
  554. # endif /* __SUNPRO_CC */
  555. # else /* ? __cplusplus */
  556. # define STLSOFT_COMPILER_LABEL_STRING "Sun Pro C"
  557. # if (0x0590 == (__SUNPRO_C & 0xFFF0))
  558. # define STLSOFT_COMPILER_VERSION_STRING "Sun Pro C v5.9"
  559. # else /* ? __SUNPRO_CC */
  560. # error Currently only version v5.9 of the Sun Pro C compiler is supported by the STLSoft libraries
  561. # endif /* __SUNPRO_CC */
  562. # endif /* __cplusplus */
  563. #elif defined(__VECTORC)
  564. /* ************************** CodePlay VectorC ************************* */
  565. # define STLSOFT_COMPILER_IS_VECTORC
  566. # define STLSOFT_COMPILER_LABEL_STRING "CodePlay VectorC C/C++"
  567. # if (__VECTORC == 1)
  568. # define STLSOFT_COMPILER_VERSION_STRING "CodePlay VectorC C/C++"
  569. # else /* ? __VECTORC */
  570. # error Currently only versions of the CodePlay Vector C/C++ compiler defining __VECTORC == 1 are supported by the STLSoft libraries
  571. # endif /* __VECTORC */
  572. #elif defined(__WATCOMC__)
  573. /* ******************************* Watcom ****************************** */
  574. # define STLSOFT_COMPILER_IS_WATCOM
  575. # define STLSOFT_COMPILER_LABEL_STRING "Watcom C/C++"
  576. # if (__WATCOMC__ == 1200)
  577. # define STLSOFT_COMPILER_VERSION_STRING "Open Watcom C/C++ 1.0"
  578. # elif (__WATCOMC__ == 1210)
  579. # define STLSOFT_COMPILER_VERSION_STRING "Open Watcom C/C++ 1.1"
  580. # elif (__WATCOMC__ == 1220)
  581. # define STLSOFT_COMPILER_VERSION_STRING "Open Watcom C/C++ 1.2"
  582. # elif (__WATCOMC__ == 1230)
  583. # define STLSOFT_COMPILER_VERSION_STRING "Open Watcom C/C++ 1.3"
  584. # elif (__WATCOMC__ == 1240)
  585. # define STLSOFT_COMPILER_VERSION_STRING "Open Watcom C/C++ 1.4"
  586. # elif (__WATCOMC__ == 1250)
  587. # define STLSOFT_COMPILER_VERSION_STRING "Open Watcom C/C++ 1.5"
  588. # elif (__WATCOMC__ == 1260)
  589. # define STLSOFT_COMPILER_VERSION_STRING "Open Watcom C/C++ 1.6"
  590. # elif (__WATCOMC__ == 1270)
  591. # define STLSOFT_COMPILER_VERSION_STRING "Open Watcom C/C++ 1.7"
  592. # else /* ? __WATCOMC__ */
  593. # error Currently only versions 1.0-1.7 of Open Watcom C/C++ are recognised by the STLSoft libraries
  594. # endif /* __WATCOMC__ */
  595. #elif defined(_MSC_VER)
  596. /* ***************************** Visual C++ **************************** */
  597. # define STLSOFT_COMPILER_IS_MSVC
  598. # define STLSOFT_COMPILER_LABEL_STRING "Visual C++"
  599. # if defined(STLSOFT_FORCE_MSVC_4_2) && (_MSC_VER == 1020)
  600. # define STLSOFT_COMPILER_VERSION_STRING "Visual C++ 4.2"
  601. # elif (_MSC_VER == 1100)
  602. # define STLSOFT_COMPILER_VERSION_STRING "Visual C++ 5.0"
  603. # elif (_MSC_VER == 1200)
  604. # define STLSOFT_COMPILER_VERSION_STRING "Visual C++ 6.0"
  605. # elif (_MSC_VER == 1300)
  606. # define STLSOFT_COMPILER_VERSION_STRING "Visual C++ 7.0"
  607. # elif (_MSC_VER == 1310)
  608. # define STLSOFT_COMPILER_VERSION_STRING "Visual C++ 7.1"
  609. # elif (_MSC_VER == 1400)
  610. # define STLSOFT_COMPILER_VERSION_STRING "Visual C++ 8.0"
  611. # elif (_MSC_VER == 1500)
  612. # define STLSOFT_COMPILER_VERSION_STRING "Visual C++ 9.0"
  613. # elif (_MSC_VER == 1600)
  614. # define STLSOFT_COMPILER_VERSION_STRING "Visual C++ 10.0"
  615. # elif (_MSC_VER == 1700)
  616. # define STLSOFT_COMPILER_VERSION_STRING "Visual C++ 11.0"
  617. # else /* ? _MSC_VER */
  618. # error Currently only versions 5.0, 6.0, 7.0, 7.1, 8.0, 9.0, 10.0 and 11.0 of the Visual C++ compiler are supported by the STLSoft libraries
  619. # endif /* _MSC_VER */
  620. #else /* ? compiler */
  621. /* ********************** No recognised compiler *********************** */
  622. # if defined(_STLSOFT_FORCE_UNKNOWN_COMPILER) || \
  623. defined(_STLSOFT_FORCE_ANY_COMPILER)
  624. # define STLSOFT_COMPILER_LABEL_STRING "Unknown (forced) compiler"
  625. # define STLSOFT_COMPILER_VERSION_STRING "Unknown (forced) compiler"
  626. # define STLSOFT_COMPILER_IS_UNKNOWN
  627. # else /* ? _STLSOFT_FORCE_UNKNOWN_COMPILER || _STLSOFT_FORCE_ANY_COMPILER */
  628. # error Compiler is not recognised.
  629. # error Currently only Borland C++, Comeau C++, Digital Mars C/C++, GNU C/C++,
  630. # error Intel C/C++, Metrowerks CodeWarrior, Visual C++ and Watcom C/C++
  631. # error compilers are supported by the STLSoft libraries
  632. # error If you want to use the libraries with your compiler, you may specify the
  633. # error _STLSOFT_FORCE_CUSTOM_COMPILER or _STLSOFT_FORCE_ANY_COMPILER preprocessor
  634. # error symbols.
  635. # error _STLSOFT_FORCE_ANY_COMPILER assumes that your compiler can support all
  636. # error modern C++ compiler features, and causes the inclusion of the compiler
  637. # error features file stlsoft/internal/cccap/unknown.h, which is provided by STLSoft.
  638. # error _STLSOFT_FORCE_CUSTOM_COMPILER requires that you specify the name of the
  639. # error compiler features file in __STLSOFT_CF_CUSTOM_COMPILER_INCLUDE_NAME.
  640. # error The idea is to use _STLSOFT_FORCE_ANY_COMPILER, to determine what language
  641. # error features your compiler can support, and then copy, edit and use that file
  642. # error via _STLSOFT_FORCE_CUSTOM_COMPILER and __STLSOFT_CF_CUSTOM_COMPILER_INCLUDE_NAME.
  643. # endif /* _STLSOFT_FORCE_ANY_COMPILER */
  644. #endif /* compiler tag */
  645. #ifdef STLSOFT_DOCUMENTATION_SKIP_SECTION
  646. /** \def STLSOFT_COMPILER_LABEL_STRING
  647. * \brief A nul-terminated C-style string denoting the name of the compiler.
  648. */
  649. # define STLSOFT_COMPILER_LABEL_STRING "Acme Compiler"
  650. /** \def STLSOFT_COMPILER_VERSION_STRING
  651. * \brief A nul-terminated C-style string denoting the name and version of the compiler.
  652. */
  653. # define STLSOFT_COMPILER_VERSION_STRING "Acme Compiler v1.0"
  654. #else /* ? STLSOFT_DOCUMENTATION_SKIP_SECTION */
  655. # define __STLSOFT_COMPILER_LABEL_STRING STLSOFT_COMPILER_LABEL_STRING
  656. # define __STLSOFT_COMPILER_VERSION_STRING STLSOFT_COMPILER_VERSION_STRING
  657. #endif /* STLSOFT_DOCUMENTATION_SKIP_SECTION */
  658. /* /////////////////////////////////////////////////////////////////////////
  659. * Compiler language feature support
  660. *
  661. * Various compilers support the language differently (or not at all), so these
  662. * features are discriminated here and utilised by various means within the code
  663. * in order to minimise the use of the preprocessor conditionals in the other
  664. * libraries' source code.
  665. */
  666. #if defined(_STLSOFT_INCLUDE_UNDEFS) || \
  667. ( defined(STLSOFT_STRICT) && \
  668. !defined(STLSOFT_NO_UNDEFS))
  669. # include <stlsoft/internal/_undefs.h>
  670. #endif /* _STLSOFT_INCLUDE_UNDEFS) || (STLSOFT_STRICT) && !STLSOFT_NO_UNDEFS) */
  671. /* Now we include the appropriate compiler-specific header */
  672. #if defined(STLSOFT_COMPILER_IS_CUSTOM)
  673. # include __STLSOFT_CF_CUSTOM_COMPILER_INCLUDE_NAME
  674. #elif defined(STLSOFT_COMPILER_IS_UNKNOWN)
  675. # include <stlsoft/internal/cccap/unknown.h>
  676. #elif defined(STLSOFT_COMPILER_IS_BORLAND)
  677. # include <stlsoft/internal/cccap/borland.h>
  678. #elif defined(STLSOFT_COMPILER_IS_COMO)
  679. # include <stlsoft/internal/cccap/como.h>
  680. #elif defined(STLSOFT_COMPILER_IS_DMC)
  681. # include <stlsoft/internal/cccap/dmc.h>
  682. #elif defined(STLSOFT_COMPILER_IS_GCC)
  683. # include <stlsoft/internal/cccap/gcc.h>
  684. #elif defined(STLSOFT_COMPILER_IS_INTEL)
  685. # include <stlsoft/internal/cccap/intel.h>
  686. #elif defined(STLSOFT_COMPILER_IS_MSVC)
  687. # include <stlsoft/internal/cccap/msvc.h>
  688. #elif defined(STLSOFT_COMPILER_IS_MWERKS)
  689. # include <stlsoft/internal/cccap/mwerks.h>
  690. #elif defined(STLSOFT_COMPILER_IS_SUNPRO)
  691. # include <stlsoft/internal/cccap/sunpro.h>
  692. #elif defined(STLSOFT_COMPILER_IS_VECTORC)
  693. # include <stlsoft/internal/cccap/vectorc.h>
  694. #elif defined(STLSOFT_COMPILER_IS_WATCOM)
  695. # include <stlsoft/internal/cccap/watcom.h>
  696. #else /* ? compiler */
  697. # error Compiler not correctly discriminated
  698. #endif /* compiler */
  699. /* pragma message support */
  700. /* backwards-compatibility : _STLSOFT_COMPILE_VERBOSE => STLSOFT_COMPILE_VERBOSE */
  701. #if defined(_STLSOFT_COMPILE_VERBOSE) && \
  702. !defined(STLSOFT_COMPILE_VERBOSE)
  703. # define STLSOFT_COMPILE_VERBOSE
  704. #endif
  705. /* backwards-compatibility : STLSOFT_CF_PRAGMA_MESSAGE_SUPPORT => STLSOFT_PPF_pragma_message_SUPPORT */
  706. #if defined(STLSOFT_CF_PRAGMA_MESSAGE_SUPPORT) && \
  707. !defined(STLSOFT_PPF_pragma_message_SUPPORT)
  708. # define STLSOFT_PPF_pragma_message_SUPPORT
  709. #endif
  710. #if defined(STLSOFT_COMPILE_VERBOSE) && \
  711. !defined(STLSOFT_PPF_pragma_message_SUPPORT)
  712. # undef STLSOFT_COMPILE_VERBOSE
  713. #endif /* !STLSOFT_PPF_pragma_message_SUPPORT && STLSOFT_COMPILE_VERBOSE */
  714. #if defined(STLSOFT_NO_COMPILE_VERBOSE) && \
  715. defined(STLSOFT_COMPILE_VERBOSE)
  716. # undef STLSOFT_COMPILE_VERBOSE
  717. #endif /* STLSOFT_NO_COMPILE_VERBOSE && STLSOFT_COMPILE_VERBOSE */
  718. #ifdef STLSOFT_COMPILE_VERBOSE
  719. # pragma message(STLSOFT_COMPILER_VERSION_STRING)
  720. #endif /* STLSOFT_COMPILE_VERBOSE */
  721. /* backwards-compatibility : STLSOFT_COMPILE_VERBOSE => _STLSOFT_COMPILE_VERBOSE */
  722. #if defined(STLSOFT_COMPILE_VERBOSE)
  723. # if defined(_STLSOFT_COMPILE_VERBOSE)
  724. # if defined(STLSOFT_PPF_pragma_message_SUPPORT)
  725. # pragma message("You have defined _STLSOFT_COMPILE_VERBOSE. This symbol is now deprecated, and may be ignored by a future release : instead define STLSOFT_COMPILE_VERBOSE")
  726. # endif
  727. # else /* ? _STLSOFT_COMPILE_VERBOSE */
  728. /* Must define it here, for backwards-compatibility with client code that uses it */
  729. # define _STLSOFT_COMPILE_VERBOSE
  730. # endif /* _STLSOFT_COMPILE_VERBOSE */
  731. #endif /* STLSOFT_COMPILE_VERBOSE */
  732. /* __FUNCTION__ support */
  733. /** \def STLSOFT_FUNCTION_SYMBOL
  734. *
  735. * The symbol to be used where __FUNCTION__ may be used, taking into account
  736. * any compiler-specific alternative forms
  737. *
  738. * \note Not defined if no appropriate symbol is available
  739. */
  740. #if defined(STLSOFT_CF_FUNCTION_SYMBOL_SUPPORT)
  741. # define STLSOFT_FUNCTION_SYMBOL __FUNCTION__
  742. #elif defined(STLSOFT_CF_func_SYMBOL_SUPPORT)
  743. # define STLSOFT_FUNCTION_SYMBOL __func__
  744. #endif /* __FUNCTION__ or __func__ */
  745. /* /////////////////////////////////////////////////////////////////////////
  746. * Sanity checks - 2
  747. *
  748. * Must have the sizes of basic integral types defined
  749. */
  750. #ifndef _STLSOFT_SIZEOF_CHAR
  751. # error _STLSOFT_SIZEOF_CHAR not defined
  752. #endif /* !_STLSOFT_SIZEOF_CHAR */
  753. #ifndef _STLSOFT_SIZEOF_SHORT
  754. # error _STLSOFT_SIZEOF_SHORT not defined
  755. #endif /* !_STLSOFT_SIZEOF_SHORT */
  756. #ifndef _STLSOFT_SIZEOF_INT
  757. # error _STLSOFT_SIZEOF_INT not defined
  758. #endif /* !_STLSOFT_SIZEOF_INT */
  759. #ifndef _STLSOFT_SIZEOF_LONG
  760. # error _STLSOFT_SIZEOF_LONG not defined
  761. #endif /* !_STLSOFT_SIZEOF_LONG */
  762. #ifdef STLSOFT_CF_BUILTIN_long_long_SUPPORT
  763. # ifndef _STLSOFT_SIZEOF_LONG_LONG
  764. # error _STLSOFT_SIZEOF_LONG_LONG not defined
  765. # endif /* !_STLSOFT_SIZEOF_LONG_LONG */
  766. #endif /* STLSOFT_CF_BUILTIN_long_long_SUPPORT */
  767. /* /////////////////////////////////////////////////////////////////////////
  768. * Sanity checks - 3
  769. *
  770. */
  771. /* Template support */
  772. #if defined(__cplusplus) && \
  773. !defined(STLSOFT_CF_TEMPLATE_SUPPORT)
  774. # error Template support not detected. STLSoft libraries are template-based and require this support.
  775. #endif /* STLSOFT_CF_TEMPLATE_SUPPORT */
  776. /* Native 64-bit integer support */
  777. #if !defined(STLSOFT_CF_64BIT_INT_SUPPORT) && \
  778. ( defined(STLSOFT_CF_64BIT_INT_IS___int64) || \
  779. defined(STLSOFT_CF_64BIT_INT_IS_long_long))
  780. # error Definition for 64-bit support is not correct. STLSOFT_CF_64BIT_INT_SUPPORT must be defined for 64-bit support
  781. #endif /* !STLSOFT_CF_64BIT_INT_SUPPORT && (STLSOFT_CF_64BIT_INT_IS___int64 || STLSOFT_CF_64BIT_INT_IS_long_long) */
  782. /* Out-of-memory throws bad_alloc.
  783. *
  784. * Discriminated symbol is STLSOFT_CF_NOTHROW_BAD_ALLOC
  785. *
  786. * By default, compilations with the Borland, and Watcom compilers throw
  787. * bad_alloc in conditions of memory exhaustion, and those with Digital Mars
  788. * and Microsoft do not.
  789. *
  790. * The Microsoft compilers do not throw bad_alloc for long established reasons,
  791. * though they can be made to do so (see Matthew Wilson, "Generating
  792. * Out-Of-Memory Exceptions", Windows Developer's Journal, Vol 12 Number 5, May
  793. * 2001). This feature may be added in a forthcoming release of the libraries.
  794. *
  795. * The Digital Mars compiler appears to ship without any header files that
  796. * define bad_alloc (whether in std or not), so it is therefore assumed that
  797. * operator new will not throw exceptions in out of memory conditions.
  798. *
  799. * Define STLSOFT_CF_THROW_BAD_ALLOC to force Digital Mars/Microsoft to do so.
  800. * Define STLSOFT_CF_NOTHROW_BAD_ALLOC to prevent Borland/Comeau/
  801. * GCC/Metrowerks/Watcom from doing so.
  802. */
  803. /* STLSOFT_CF_EXCEPTION_SUPPORT */
  804. # if defined(__STLSOFT_CF_EXCEPTION_SUPPORT) && \
  805. !defined(STLSOFT_CF_EXCEPTION_SUPPORT)
  806. # error Configuration error: deprecated symbol __STLSOFT_CF_EXCEPTION_SUPPORT is defined when STLSOFT_CF_EXCEPTION_SUPPORT is not!
  807. # else /* ? STLSOFT_CF_INT_DISTINCT_INT_TYPE */
  808. # ifdef STLSOFT_CF_EXCEPTION_SUPPORT
  809. # define __STLSOFT_CF_EXCEPTION_SUPPORT
  810. # endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
  811. # endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
  812. /* STLSOFT_CF_EXCEPTION_SUPPORT */
  813. # if defined(__STLSOFT_CF_EXCEPTION_SIGNATURE_SUPPORT) && \
  814. !defined(STLSOFT_CF_EXCEPTION_SIGNATURE_SUPPORT)
  815. # error Configuration error: deprecated symbol __STLSOFT_CF_EXCEPTION_SIGNATURE_SUPPORT is defined when STLSOFT_CF_EXCEPTION_SIGNATURE_SUPPORT is not!
  816. # else /* ? STLSOFT_CF_INT_DISTINCT_INT_TYPE */
  817. # ifdef STLSOFT_CF_EXCEPTION_SIGNATURE_SUPPORT
  818. # define __STLSOFT_CF_EXCEPTION_SIGNATURE_SUPPORT
  819. # endif /* STLSOFT_CF_EXCEPTION_SIGNATURE_SUPPORT */
  820. # endif /* STLSOFT_CF_EXCEPTION_SIGNATURE_SUPPORT */
  821. #ifndef STLSOFT_CF_EXCEPTION_SUPPORT
  822. /** \def STLSOFT_CF_NOTHROW_BAD_ALLOC
  823. * \brief Define if you've overridden <code>operator new</code> to return
  824. * <code>NULL</code> on allocation failure (which is non-standard
  825. * behaviour).
  826. */
  827. # define STLSOFT_CF_NOTHROW_BAD_ALLOC
  828. #endif /* !STLSOFT_CF_EXCEPTION_SUPPORT */
  829. #ifdef STLSOFT_CF_NOTHROW_BAD_ALLOC
  830. # ifdef STLSOFT_CF_THROW_BAD_ALLOC
  831. # undef STLSOFT_CF_THROW_BAD_ALLOC
  832. # endif /* STLSOFT_CF_THROW_BAD_ALLOC */
  833. #else /* ? STLSOFT_CF_NOTHROW_BAD_ALLOC */
  834. /* Leave it to whatever the compiler's capability discrimination has determined */
  835. #endif /* STLSOFT_CF_NOTHROW_BAD_ALLOC */
  836. /* Template specialisation syntax support
  837. */
  838. /** \def STLSOFT_TEMPLATE_SPECIALISATION
  839. * \brief Resolves to <code>template <></code> for compilers that support correct
  840. * template specialisation syntax, and to nothing for those that do not.
  841. */
  842. #ifdef STLSOFT_TEMPLATE_SPECIALISATION
  843. # undef STLSOFT_TEMPLATE_SPECIALISATION
  844. #endif /* STLSOFT_TEMPLATE_SPECIALISATION */
  845. #ifdef STLSOFT_CF_TEMPLATE_SPECIALISATION_SYNTAX
  846. # define STLSOFT_TEMPLATE_SPECIALISATION template <>
  847. #else /* ? STLSOFT_CF_TEMPLATE_SPECIALISATION_SYNTAX */
  848. # define STLSOFT_TEMPLATE_SPECIALISATION
  849. #endif /* STLSOFT_CF_TEMPLATE_SPECIALISATION_SYNTAX */
  850. /* Keyword support.
  851. *
  852. * Define _STLSOFT_FORCE_ALL_KEYWORDS to force the assumption of compiler
  853. * support for all keywords.
  854. *
  855. * Define _STLSOFT_FORCE_KEYWORD_EXPLICIT to force the assumption of compiler
  856. * support for the explicit keyword
  857. *
  858. * Define _STLSOFT_FORCE_KEYWORD_MUTABLE to force the assumption of compiler
  859. * support for the mutable keyword
  860. *
  861. * Define _STLSOFT_FORCE_KEYWORD_TYPENAME to force the assumption of compiler
  862. * support for the typename keyword
  863. */
  864. #ifdef _STLSOFT_FORCE_ALL_KEYWORDS
  865. # define _STLSOFT_FORCE_KEYWORD_EXPLICIT
  866. # define _STLSOFT_FORCE_KEYWORD_MUTABLE
  867. # define _STLSOFT_FORCE_KEYWORD_TYPENAME
  868. #endif /* _STLSOFT_FORCE_ALL_KEYWORDS */
  869. #if !defined(STLSOFT_CF_EXPLICIT_KEYWORD_SUPPORT) && \
  870. defined(_STLSOFT_FORCE_KEYWORD_EXPLICIT)
  871. # define STLSOFT_CF_EXPLICIT_KEYWORD_SUPPORT
  872. #endif /* !STLSOFT_CF_EXPLICIT_KEYWORD_SUPPORT && _STLSOFT_FORCE_KEYWORD_EXPLICIT */
  873. #if !defined(STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT) && \
  874. defined(_STLSOFT_FORCE_KEYWORD_MUTABLE)
  875. # define STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT
  876. #endif /* !STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT && _STLSOFT_FORCE_KEYWORD_MUTABLE */
  877. #if !defined(STLSOFT_CF_TYPENAME_PARAM_KEYWORD_SUPPORT) && \
  878. defined(_STLSOFT_FORCE_KEYWORD_TYPENAME)
  879. # define STLSOFT_CF_TYPENAME_PARAM_KEYWORD_SUPPORT
  880. #endif /* !STLSOFT_CF_TYPENAME_PARAM_KEYWORD_SUPPORT && _STLSOFT_FORCE_KEYWORD_TYPENAME */
  881. #if !defined(STLSOFT_CF_TYPENAME_TYPE_KEYWORD_SUPPORT) && \
  882. defined(_STLSOFT_FORCE_KEYWORD_TYPENAME)
  883. # define STLSOFT_CF_TYPENAME_TYPE_KEYWORD_SUPPORT
  884. #endif /* !STLSOFT_CF_TYPENAME_TYPE_KEYWORD_SUPPORT && _STLSOFT_FORCE_KEYWORD_TYPENAME */
  885. #if !defined(STLSOFT_CF_TYPENAME_TYPE_DEF_KEYWORD_SUPPORT) && \
  886. defined(_STLSOFT_FORCE_KEYWORD_TYPENAME)
  887. # define STLSOFT_CF_TYPENAME_TYPE_DEF_KEYWORD_SUPPORT
  888. #endif /* !STLSOFT_CF_TYPENAME_TYPE_DEF_KEYWORD_SUPPORT && _STLSOFT_FORCE_KEYWORD_TYPENAME */
  889. #if !defined(STLSOFT_CF_TYPENAME_TYPE_MIL_KEYWORD_SUPPORT) && \
  890. defined(_STLSOFT_FORCE_KEYWORD_TYPENAME)
  891. # define STLSOFT_CF_TYPENAME_TYPE_MIL_KEYWORD_SUPPORT
  892. #endif /* !STLSOFT_CF_TYPENAME_TYPE_MIL_KEYWORD_SUPPORT && _STLSOFT_FORCE_KEYWORD_TYPENAME */
  893. #if !defined(STLSOFT_CF_TYPENAME_TYPE_RET_KEYWORD_SUPPORT) && \
  894. defined(_STLSOFT_FORCE_KEYWORD_TYPENAME)
  895. # define STLSOFT_CF_TYPENAME_TYPE_RET_KEYWORD_SUPPORT
  896. #endif /* !STLSOFT_CF_TYPENAME_TYPE_RET_KEYWORD_SUPPORT && _STLSOFT_FORCE_KEYWORD_TYPENAME */
  897. /* /////////////////////////////////////////////////////////////////////////
  898. * Calling convention
  899. */
  900. /* Calling convention support symbols */
  901. #ifdef STLSOFT_DOCUMENTATION_SKIP_SECTION
  902. /** \def STLSOFT_CF_CDECL_SUPPORTED
  903. * \brief When defined, indicates that the compiler supports the <b>cdecl</b> calling convention.
  904. */
  905. # define STLSOFT_CF_CDECL_SUPPORTED
  906. /** \def STLSOFT_CF_FASTCALL_SUPPORTED
  907. * \brief When defined, indicates that the compiler supports the <b>fastcall</b> calling convention.
  908. */
  909. # define STLSOFT_CF_FASTCALL_SUPPORTED
  910. /** \def STLSOFT_CF_STDCALL_SUPPORTED
  911. * \brief When defined, indicates that the compiler supports the <b>stdcall</b> calling convention.
  912. */
  913. # define STLSOFT_CF_STDCALL_SUPPORTED
  914. #endif /* STLSOFT_DOCUMENTATION_SKIP_SECTION */
  915. /* Calling convention keyword abstraction */
  916. /** \def STLSOFT_CDECL
  917. * \brief Resolves to the <b>cdecl</b> keyword for the current compiler, or to nothing for compilers
  918. * that do not support any calling conventions.
  919. */
  920. #if !defined(STLSOFT_CDECL)
  921. # define STLSOFT_CDECL
  922. #endif /* !STLSOFT_CDECL */
  923. /** \def STLSOFT_FASTCALL
  924. * \brief Resolves to the <b>fastcall</b> keyword for the current compiler
  925. */
  926. #if !defined(STLSOFT_FASTCALL)
  927. # if defined(STLSOFT_CF_FASTCALL_SUPPORTED)
  928. # error Compiler discrimination must define STLSOFT_FASTCALL if STLSOFT_CF_FASTCALL_SUPPORTED is defined
  929. # else /* ? STLSOFT_CF_FASTCALL_SUPPORTED */
  930. # define STLSOFT_FASTCALL
  931. # endif /* STLSOFT_CF_FASTCALL_SUPPORTED */
  932. #endif /* !STLSOFT_FASTCALL */
  933. /** \def STLSOFT_STDCALL
  934. * \brief Resolves to the <b>stdcall</b> keyword for the current compiler
  935. */
  936. #if !defined(STLSOFT_STDCALL)
  937. # if defined(STLSOFT_CF_STDCALL_SUPPORTED)
  938. # error Compiler discrimination must define STLSOFT_STDCALL if STLSOFT_CF_STDCALL_SUPPORTED is defined
  939. # else /* ? STLSOFT_CF_STDCALL_SUPPORTED */
  940. # define STLSOFT_STDCALL
  941. # endif /* STLSOFT_CF_STDCALL_SUPPORTED */
  942. #endif /* !STLSOFT_STDCALL */
  943. /* Calling convention facility values */
  944. /** \def STLSOFT_CC_CDECL_VALUE
  945. *
  946. * An unique (flag) integer value set to
  947. * <code>0x01</code>
  948. * if the
  949. * <strong>cdecl</strong>
  950. * calling convention is supported, otherwise set to
  951. * <code>0</code>.
  952. */
  953. /** \def STLSOFT_CC_FASTCALL_VALUE
  954. *
  955. * An unique (flag) integer value set to
  956. * <code>0x02</code>
  957. * if the
  958. * <strong>fastcall</strong>
  959. * calling convention is supported, otherwise set to
  960. * <code>0</code>.
  961. */
  962. /** \def STLSOFT_CC_STDCALL_VALUE
  963. *
  964. * An unique (flag) integer value set to
  965. * <code>0x04</code>
  966. * if the
  967. * <strong>stdcall</strong>
  968. * calling convention is supported, otherwise set to
  969. * <code>0</code>.
  970. */
  971. /** \def STLSOFT_CC_COMBINED_VALUE
  972. *
  973. * Combination of STLSOFT_CC_CDECL_VALUE, STLSOFT_CC_FASTCALL_VALUE
  974. * and STLSOFT_CC_STDCALL_VALUE.
  975. */
  976. #if defined(STLSOFT_CF_CDECL_SUPPORTED)
  977. # define STLSOFT_CDECL_VALUE (1) /*!< \deprecated This symbol is deprecated, and will be removed from a future version */
  978. # define STLSOFT_CC_CDECL_VALUE (0x01)
  979. #else
  980. # define STLSOFT_CC_CDECL_VALUE (0)
  981. #endif /* STLSOFT_CF_CDECL_SUPPORTED */
  982. #if defined(STLSOFT_CF_FASTCALL_SUPPORTED)
  983. # define STLSOFT_FASTCALL_VALUE (2) /*!< \deprecated This symbol is deprecated, and will be removed from a future version */
  984. # define STLSOFT_CC_FASTCALL_VALUE (0x02)
  985. #else
  986. # define STLSOFT_CC_FASTCALL_VALUE (0)
  987. #endif /* STLSOFT_CF_FASTCALL_SUPPORTED */
  988. #if defined(STLSOFT_CF_STDCALL_SUPPORTED)
  989. # define STLSOFT_STDCALL_VALUE (3) /*!< \deprecated This symbol is deprecated, and will be removed from a future version */
  990. # define STLSOFT_CC_STDCALL_VALUE (0x04)
  991. #else
  992. # define STLSOFT_CC_STDCALL_VALUE (0)
  993. #endif /* STLSOFT_CF_STDCALL_SUPPORTED */
  994. #define STLSOFT_CC_COMBINED_VALUE (STLSOFT_CC_CDECL_VALUE | STLSOFT_CC_FASTCALL_VALUE | STLSOFT_CC_STDCALL_VALUE)
  995. /* /////////////////////////////////////////////////////////////////////////
  996. * operator bool()
  997. *
  998. * If the symbol STLSOFT_CF_OPERATOR_BOOL_AS_OPERATOR_POINTER_TO_MEMBER_SUPPORT
  999. * is defined, operator bool should be defined as follows:
  1000. *
  1001. * class X
  1002. * {
  1003. * private:
  1004. * struct boolean { int i; }
  1005. * typedef int boolean::*boolean_t;
  1006. * public:
  1007. * operator boolean_t () const;
  1008. *
  1009. * otherwise it should be
  1010. *
  1011. * class X
  1012. * {
  1013. * private:
  1014. * typedef ss_bool_t boolean_t;
  1015. * public:
  1016. * operator boolean_t () const;
  1017. *
  1018. *
  1019. * If the symbol STLSOFT_CF_OPERATOR_NOT_VIA_OPERATOR_POINTER_TO_MEMBER_SUPPORT
  1020. * is defined, it means that (!x) can de deduced by the compiler, otherwise it
  1021. * will need to be provided
  1022. *
  1023. * If STLSOFT_CF_OPERATOR_BOOL_AS_OPERATOR_POINTER_TO_MEMBER_SUPPORT is not defined
  1024. * then STLSOFT_CF_OPERATOR_NOT_VIA_OPERATOR_POINTER_TO_MEMBER_SUPPORT should not be
  1025. * defined, so we do a check here.
  1026. *
  1027. */
  1028. #if !defined(STLSOFT_CF_OPERATOR_BOOL_AS_OPERATOR_POINTER_TO_MEMBER_SUPPORT) && \
  1029. defined(STLSOFT_CF_OPERATOR_NOT_VIA_OPERATOR_POINTER_TO_MEMBER_SUPPORT)
  1030. # error Cannot rely on use of boolean as pointer to member for operator !
  1031. # error Undefine STLSOFT_CF_OPERATOR_NOT_VIA_OPERATOR_POINTER_TO_MEMBER_SUPPORT when
  1032. # error STLSOFT_CF_OPERATOR_BOOL_AS_OPERATOR_POINTER_TO_MEMBER_SUPPORT is not defined
  1033. #endif /* !STLSOFT_CF_OPERATOR_BOOL_AS_OPERATOR_POINTER_TO_MEMBER_SUPPORT && STLSOFT_CF_OPERATOR_NOT_VIA_OPERATOR_POINTER_TO_MEMBER_SUPPORT */
  1034. /* /////////////////////////////////////////////////////////////////////////
  1035. * Obsolete symbol definitions
  1036. *
  1037. * Define _STLSOFT_INCLUDE_OBSOLETE to include the definitions of symbols prior
  1038. * to version 1.5.1
  1039. */
  1040. /* Verify that the significant changes to STLSoft 1.5.1 are checked with respect
  1041. * to other previously released projects
  1042. */
  1043. #if ( defined(_ATLSTL_VER) && \
  1044. _ATLSTL_VER <= 0x00010204) || \
  1045. ( defined(_COMSTL_VER) && \
  1046. _COMSTL_VER <= 0x00010201) || \
  1047. ( defined(_MFCSTL_VER) && \
  1048. _MFCSTL_VER <= 0x00010202) || \
  1049. ( defined(_UNIXSTL_VER) && \
  1050. _UNIXSTL_VER <= 0x00000901) || \
  1051. ( defined(_WINSTL_VER) && \
  1052. _WINSTL_VER <= 0x00010201)
  1053. # ifdef STLSOFT_STRICT
  1054. # error You are using an old version of one or more of ATLSTL, COMSTL, MFCSTL, UNIXSTL and WinSTL. Please upgrade all dependent projects in line with the STLSoft version you are using
  1055. # else /* ? STLSOFT_STRICT */
  1056. # ifdef STLSOFT_COMPILE_VERBOSE
  1057. # pragma message("You are using an old version of one or more of ATLSTL, COMSTL, MFCSTL, UNIXSTL and WinSTL. _STLSOFT_INCLUDE_OBSOLETE will be defined (but is not guaranteed to work!)")
  1058. # endif /* STLSOFT_COMPILE_VERBOSE */
  1059. # ifndef _STLSOFT_INCLUDE_OBSOLETE
  1060. # define _STLSOFT_INCLUDE_OBSOLETE
  1061. # endif /* !_STLSOFT_INCLUDE_OBSOLETE */
  1062. # endif /* STLSOFT_STRICT */
  1063. #endif /* sub-project versions */
  1064. /* /////////////////////////////////////////////////////////////////////////
  1065. * Includes
  1066. */
  1067. #ifdef STLSOFT_DOCUMENTATION_SKIP_SECTION
  1068. # ifdef _STLSOFT_NO_STD_INCLUDES
  1069. # undef _STLSOFT_NO_STD_INCLUDES
  1070. # endif /* _STLSOFT_NO_STD_INCLUDES */
  1071. #endif /* STLSOFT_DOCUMENTATION_SKIP_SECTION */
  1072. #ifndef _STLSOFT_NO_STD_INCLUDES
  1073. # ifndef STLSOFT_INCL_H_STDDEF
  1074. # define STLSOFT_INCL_H_STDDEF
  1075. # include <stddef.h> /* standard types */
  1076. # endif /* !STLSOFT_INCL_H_STDDEF */
  1077. # ifndef STLSOFT_INCL_H_STDLIB
  1078. # define STLSOFT_INCL_H_STDLIB
  1079. # include <stdlib.h> /* standard constants */
  1080. # endif /* !STLSOFT_INCL_H_STDLIB */
  1081. #endif /* !_STLSOFT_NO_STD_INCLUDES */
  1082. /* /////////////////////////////////////////////////////////////////////////
  1083. * Contract Enforcement
  1084. *
  1085. * The macro STLSOFT_ASSERT provides standard debug-mode assert functionality.
  1086. */
  1087. /** \defgroup assertion_macros Assertion Macros
  1088. * \ingroup group__project__stlsoft
  1089. * \brief These macros are used for debugging / contract-enforcement
  1090. * @{
  1091. */
  1092. #if defined(_STLSOFT_NO_ASSERT) && \
  1093. defined(STLSOFT_CF_ASSERT_SUPPORT)
  1094. # undef STLSOFT_CF_ASSERT_SUPPORT
  1095. #endif /* _STLSOFT_NO_ASSERT && STLSOFT_CF_ASSERT_SUPPORT */
  1096. /** \def STLSOFT_ASSERT(ex)
  1097. * \brief Defines an assertion construct for runtime verification.
  1098. *
  1099. * \param ex Must be non-zero, or an assertion will be fired
  1100. *
  1101. * \note By default, the macro resolves to the standard macro
  1102. * <code>assert()</code> or the equivalent default assertion macro
  1103. * for the compiler (e.g. <code>_ASSERTE()</code> for Visual C++).
  1104. * This behaviour can be overriden by not defining: see the
  1105. * compiler capability file for your compiler (e.g.
  1106. * <code>include/stlsoft/internal/cccap/gcc.h</code>) for further
  1107. * details.
  1108. */
  1109. #if defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  1110. # define STLSOFT_ASSERT(ex) assert(ex)
  1111. #elif defined(STLSOFT_CF_ASSERT_SUPPORT)
  1112. # ifdef __STLSOFT_CF_USE_cassert
  1113. /* Using the standard assertion mechanism, located in <cassert> */
  1114. # ifdef __cplusplus
  1115. # include <cassert>
  1116. # else /* ? __cplusplus */
  1117. # include <assert.h>
  1118. # endif /* __cplusplus */
  1119. # define STLSOFT_ASSERT(ex) assert(ex)
  1120. # else /* ? __STLSOFT_CF_USE_cassert */
  1121. /* Using either a custom or proprietary assertion mechanism, so must
  1122. * provide the header include name
  1123. */
  1124. # ifndef __STLSOFT_CF_ASSERT_INCLUDE_NAME
  1125. # error Must supply an assert include filename with custom or proprietary assertion mechanism
  1126. # else /* ? __STLSOFT_CF_ASSERT_INCLUDE_NAME */
  1127. # include __STLSOFT_CF_ASSERT_INCLUDE_NAME
  1128. # endif /* !__STLSOFT_CF_ASSERT_INCLUDE_NAME */
  1129. # endif /* __STLSOFT_CF_USE_cassert */
  1130. # if !defined(STLSOFT_ASSERT) && \
  1131. defined(stlsoft_assert)
  1132. # define STLSOFT_ASSERT stlsoft_assert
  1133. # elif defined(STLSOFT_ASSERT) && \
  1134. defined(stlsoft_assert)
  1135. # error Your compiler discrimination file cannot define both STLSOFT_ASSERT and stlsoft_assert. The former is the new version, and replaces the latter
  1136. # endif /* STLSOFT_ASSERT / stlsoft_assert */
  1137. # ifndef STLSOFT_ASSERT
  1138. # error If your compiler discrimination file supports assertions, it must define STLSOFT_ASSERT() (taking a single parameter)
  1139. # endif /* !STLSOFT_ASSERT */
  1140. #endif /* !STLSOFT_CF_ASSERT_SUPPORT */
  1141. #ifdef STLSOFT_DOCUMENTATION_SKIP_SECTION
  1142. # undef stlsoft_assert
  1143. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  1144. /** \def stlsoft_assert(ex)
  1145. *
  1146. * \brief [DEPRECATED] Defines a runtime assertion
  1147. *
  1148. * \param ex Must be non-zero, or an assertion will be fired
  1149. *
  1150. * \deprecated This is deprecated in favour of \ref STLSOFT_ASSERT().
  1151. *
  1152. * \note This is a simple \#define for STLSOFT_ASSERT()
  1153. */
  1154. #ifndef stlsoft_assert
  1155. # define stlsoft_assert(ex) STLSOFT_ASSERT(ex)
  1156. #endif /* !stlsoft_assert */
  1157. /** \def STLSOFT_MESSAGE_ASSERT(msg, ex)
  1158. * \brief Defines a runtime assertion, with message
  1159. *
  1160. * \param ex Must be non-zero, or an assertion will be fired
  1161. * \param msg The literal character string message to be included in the assertion
  1162. */
  1163. #if defined(STLSOFT_CF_ASSERT_SUPPORT)
  1164. # if defined(__WATCOMC__)
  1165. # define STLSOFT_MESSAGE_ASSERT(msg, ex) STLSOFT_ASSERT(ex)
  1166. # elif defined(__COMO__) || \
  1167. defined(__GNUC__) || \
  1168. defined(__MWERKS__)
  1169. # define STLSOFT_MESSAGE_ASSERT(msg, ex) STLSOFT_ASSERT((msg && (ex)))
  1170. # else /* ? compiler */
  1171. # define STLSOFT_MESSAGE_ASSERT(msg, ex) STLSOFT_ASSERT((msg, ex))
  1172. # endif /* __WATCOMC__ */
  1173. #else /* ? STLSOFT_CF_ASSERT_SUPPORT */
  1174. # define STLSOFT_MESSAGE_ASSERT(msg, ex)
  1175. #endif /* STLSOFT_CF_ASSERT_SUPPORT */
  1176. /** \def stlsoft_message_assert(ex)
  1177. *
  1178. * \brief [DEPRECATED] Defines a runtime assertion, with message
  1179. *
  1180. * \param ex Must be non-zero, or an assertion will be fired
  1181. * \param msg The literal character string message to be included in the assertion
  1182. *
  1183. * \deprecated This is deprecated in favour of \ref STLSOFT_MESSAGE_ASSERT().
  1184. *
  1185. * \note This is a simple \#define for STLSOFT_MESSAGE_ASSERT()
  1186. */
  1187. #define stlsoft_message_assert(msg, ex) STLSOFT_MESSAGE_ASSERT(msg, ex)
  1188. /*
  1189. * TODO: decide on a form of static_assert with message (as the C++11 static_assert does)
  1190. */
  1191. /** \def STLSOFT_STATIC_ASSERT(ex)
  1192. *
  1193. * \brief Defines an assertion construct for compile-time verification.
  1194. *
  1195. * \param ex A compile-time evaluatable condition that must be non-zero, or compilation will fail.
  1196. */
  1197. #if defined(STLSOFT_CF_static_assert_SUPPORT)
  1198. # define STLSOFT_STATIC_ASSERT(ex) static_assert((ex), #ex)
  1199. #elif defined(STLSOFT_CF_STATIC_ASSERT_SUPPORT)
  1200. # if defined(STLSOFT_COMPILER_IS_GCC) || \
  1201. defined(STLSOFT_COMPILER_IS_INTEL)
  1202. # define STLSOFT_STATIC_ASSERT(ex) do { typedef int ai[(ex) ? 1 : -1]; } while(0)
  1203. # else /* ? compiler */
  1204. # define STLSOFT_STATIC_ASSERT(ex) do { typedef int ai[(ex) ? 1 : 0]; } while(0)
  1205. # endif /* compiler */
  1206. #else /* ? STLSOFT_CF_STATIC_ASSERT_SUPPORT */
  1207. # define STLSOFT_STATIC_ASSERT(ex) STLSOFT_MESSAGE_ASSERT("Static assertion failed: ", (ex))
  1208. #endif /* STLSOFT_CF_STATIC_ASSERT_SUPPORT */
  1209. /** \def stlsoft_static_assert(ex)
  1210. *
  1211. * \brief [DEPRECATED] Defines a compile-time assertion
  1212. *
  1213. * \param ex Must be non-zero, or compilation will fail
  1214. *
  1215. * \note This is a simple \#define for STLSOFT_STATIC_ASSERT()
  1216. *
  1217. * \deprecated This is <b>heavily</b> deprecated in favour of \ref STLSOFT_STATIC_ASSERT().
  1218. */
  1219. #define stlsoft_static_assert(ex) STLSOFT_STATIC_ASSERT(ex)
  1220. /** @} */
  1221. /* /////////////////////////////////////////////////////////////////////////
  1222. * Deprecation
  1223. *
  1224. */
  1225. /** \def STLSOFT_DECLARE_DEPRECATION()
  1226. *
  1227. * Marks the succeeding symbol as being deprecated in a compiler-dependent
  1228. * manner.
  1229. *
  1230. * \see STLSOFT_DECLARE_DEPRECATION_MESSAGE
  1231. * \see STLSOFT_DECLARE_FUNCTION_DEPRECATION
  1232. * \see STLSOFT_DECLARE_FUNCTION_DEPRECATION_IN_FAVOUR_OF
  1233. * \see STLSOFT_DECLARE_MACRO_DEPRECATION
  1234. * \see STLSOFT_DECLARE_MACRO_DEPRECATION_IN_FAVOUR_OF
  1235. *
  1236. * \ingroup group__utility
  1237. */
  1238. /** \def STLSOFT_DECLARE_DEPRECATION_MESSAGE(message)
  1239. *
  1240. * Used to attach a custom deprecation message to the succeeding symbol, for
  1241. * supporting compilers, in a compiler-dependent manner.
  1242. *
  1243. * \param message The custom deprecation message to attach to the symbol.
  1244. *
  1245. * \see STLSOFT_DECLARE_DEPRECATION
  1246. * \see STLSOFT_DECLARE_FUNCTION_DEPRECATION
  1247. * \see STLSOFT_DECLARE_FUNCTION_DEPRECATION_IN_FAVOUR_OF
  1248. * \see STLSOFT_DECLARE_MACRO_DEPRECATION
  1249. * \see STLSOFT_DECLARE_MACRO_DEPRECATION_IN_FAVOUR_OF
  1250. *
  1251. * \ingroup group__utility
  1252. */
  1253. /** \def STLSOFT_DECLARE_FUNCTION_DEPRECATION(fn)
  1254. *
  1255. * Used to attach a standard deprecation message to the succeeding function,
  1256. * for supporting compilers, in a compiler-dependent manner.
  1257. *
  1258. * \param fn The name of the symbol.
  1259. *
  1260. * \ingroup group__utility
  1261. *
  1262. * \see STLSOFT_DECLARE_DEPRECATION
  1263. * \see STLSOFT_DECLARE_DEPRECATION_MESSAGE
  1264. * \see STLSOFT_DECLARE_FUNCTION_DEPRECATION_IN_FAVOUR_OF
  1265. * \see STLSOFT_DECLARE_MACRO_DEPRECATION
  1266. * \see STLSOFT_DECLARE_MACRO_DEPRECATION_IN_FAVOUR_OF
  1267. */
  1268. /** \def STLSOFT_DECLARE_FUNCTION_DEPRECATION_IN_FAVOUR_OF(oldfn, newfn)
  1269. *
  1270. * Used to attach a standard deprecation message to the succeeding function,
  1271. * stipulating a function to use instead, for supporting compilers, in a
  1272. * compiler-dependent manner.
  1273. *
  1274. * \param oldfn The name of the symbol being deprecated.
  1275. * \param newfn The name of the new symbol to be used instead.
  1276. *
  1277. * \ingroup group__utility
  1278. *
  1279. * \see STLSOFT_DECLARE_DEPRECATION
  1280. * \see STLSOFT_DECLARE_DEPRECATION_MESSAGE
  1281. * \see STLSOFT_DECLARE_FUNCTION_DEPRECATION
  1282. * \see STLSOFT_DECLARE_MACRO_DEPRECATION
  1283. * \see STLSOFT_DECLARE_MACRO_DEPRECATION_IN_FAVOUR_OF
  1284. */
  1285. /** \def STLSOFT_DECLARE_MACRO_DEPRECATION(mac)
  1286. *
  1287. * Used to attach a standard deprecation message to the succeeding macro,
  1288. * for supporting compilers, in a compiler-dependent manner.
  1289. *
  1290. * \param mac The name of the symbol.
  1291. *
  1292. * \ingroup group__utility
  1293. *
  1294. * \see STLSOFT_DECLARE_DEPRECATION
  1295. * \see STLSOFT_DECLARE_DEPRECATION_MESSAGE
  1296. * \see STLSOFT_DECLARE_FUNCTION_DEPRECATION
  1297. * \see STLSOFT_DECLARE_FUNCTION_DEPRECATION_IN_FAVOUR_OF
  1298. * \see STLSOFT_DECLARE_MACRO_DEPRECATION_IN_FAVOUR_OF
  1299. */
  1300. /** \def STLSOFT_DECLARE_MACRO_DEPRECATION_IN_FAVOUR_OF(oldmac, newmac)
  1301. *
  1302. * Used to attach a standard deprecation message to the succeeding macro,
  1303. * stipulating a macro to use instead, for supporting compilers, in a
  1304. * compiler-dependent manner.
  1305. *
  1306. * \param oldmac The name of the symbol being deprecated.
  1307. * \param newmac The name of the new symbol to be used instead.
  1308. *
  1309. * \ingroup group__utility
  1310. *
  1311. * \see STLSOFT_DECLARE_DEPRECATION
  1312. * \see STLSOFT_DECLARE_DEPRECATION_MESSAGE
  1313. * \see STLSOFT_DECLARE_FUNCTION_DEPRECATION
  1314. * \see STLSOFT_DECLARE_FUNCTION_DEPRECATION_IN_FAVOUR_OF
  1315. * \see STLSOFT_DECLARE_MACRO_DEPRECATION
  1316. */
  1317. #if defined(STLSOFT_COMPILER_IS_MSVC) && \
  1318. STLSOFT_MSVC_VER >= 140050320
  1319. # define STLSOFT_DECLARE_DEPRECATION() \
  1320. \
  1321. __declspec(deprecated)
  1322. # define STLSOFT_DECLARE_DEPRECATION_MESSAGE(message) \
  1323. \
  1324. __declspec(deprecated(message))
  1325. # define STLSOFT_DECLARE_FUNCTION_DEPRECATION(fn) \
  1326. \
  1327. STLSOFT_DECLARE_DEPRECATION_MESSAGE("The function " STLSOFT_STRINGIZE(fn) " is deprecated and will be removed from a future version of STLSoft")
  1328. # define STLSOFT_DECLARE_FUNCTION_DEPRECATION_IN_FAVOUR_OF(oldfn, newfn) \
  1329. \
  1330. STLSOFT_DECLARE_DEPRECATION_MESSAGE("The function " STLSOFT_STRINGIZE(oldfn) " is deprecated and will be removed from a future version of STLSoft; use " STLSOFT_STRINGIZE(newfn) " instead")
  1331. # define STLSOFT_DECLARE_MACRO_DEPRECATION(fn)
  1332. # define STLSOFT_DECLARE_MACRO_DEPRECATION_IN_FAVOUR_OF(oldfn, newfn)
  1333. #else /* ? compiler */
  1334. # define STLSOFT_DECLARE_DEPRECATION()
  1335. # define STLSOFT_DECLARE_DEPRECATION_MESSAGE(message)
  1336. # define STLSOFT_DECLARE_FUNCTION_DEPRECATION(fn)
  1337. # define STLSOFT_DECLARE_FUNCTION_DEPRECATION_IN_FAVOUR_OF(oldfn, newfn)
  1338. # define STLSOFT_DECLARE_MACRO_DEPRECATION(mac)
  1339. # define STLSOFT_DECLARE_MACRO_DEPRECATION_IN_FAVOUR_OF(oldmac, newmac)
  1340. #endif /* compiler */
  1341. /* /////////////////////////////////////////////////////////////////////////
  1342. * Namespace
  1343. *
  1344. * The STLSoft uses namespaces by default, unless the _STLSOFT_NO_NAMESPACES
  1345. * preprocessor symbol is defined, in which case all elements are placed within
  1346. * the global namespace.
  1347. *
  1348. * The macro stlsoft_ns_qual() macro can be used to refer to elements in the
  1349. * STLSoft libraries irrespective of whether they are in the stlsoft namespace
  1350. * or in the global namespace.
  1351. *
  1352. * Some compilers do not support the standard library in the std namespace, so
  1353. * the stlsoft_ns_qual_std() macro can be used to refer to elements in the
  1354. * STLSoft libraries irrespective of whether they are in the std namespace or
  1355. * in the global namespace.
  1356. */
  1357. /* No C++ compilation means no namespaces */
  1358. #if !defined(__cplusplus)
  1359. # if !defined(_STLSOFT_NO_NAMESPACES)
  1360. # define _STLSOFT_NO_NAMESPACES
  1361. # endif /* !_STLSOFT_NO_NAMESPACES */
  1362. #endif /* !__cplusplus */
  1363. /* No STLSoft namespaces means no stlsoft namespace */
  1364. #if defined(_STLSOFT_NO_NAMESPACES)
  1365. # if !defined(_STLSOFT_NO_NAMESPACE)
  1366. # define _STLSOFT_NO_NAMESPACE
  1367. # endif /* !_STLSOFT_NO_NAMESPACE */
  1368. #endif /* _STLSOFT_NO_NAMESPACES */
  1369. #ifndef _STLSOFT_NO_NAMESPACE
  1370. /** \brief The <code class="namespace">stlsoft</code> namespace contains
  1371. * all components in the \ref group__project__stlsoft "STLSoft" project,
  1372. * and is the root namespace within which all the other
  1373. * \ref group__projects "STLSoft sub-projects" reside.
  1374. *
  1375. * \note If either/both of the symbols <code>_STLSOFT_NO_NAMESPACES</code>
  1376. * and <code>_STLSOFT_NO_NAMESPACE</code> are defined, all
  1377. * \ref group__project__stlsoft "STLSoft" components will be defined in the
  1378. * global namespace. The difference between the two is that definition of
  1379. * <code>_STLSOFT_NO_NAMESPACES</code> causes all STLSoft library
  1380. * components (i.e. those of <b>all</b>
  1381. * \ref group__projects "STLSoft sub-projects") to be defined in the
  1382. * global namespace, whereas <code>_STLSOFT_NO_NAMESPACES</code> has this
  1383. * effect on only those within the main
  1384. * \ref group__project__stlsoft "STLSoft" project.
  1385. *
  1386. * \note This is a vestige of compatibility with compilers with
  1387. * no (or no sensible) namespace support that is maintained for reasons of
  1388. * backwards compatiblity and because it is, in <i>rare circumstances</i>, a
  1389. * useful facility.
  1390. */
  1391. namespace stlsoft
  1392. {
  1393. #endif /* !_STLSOFT_NO_NAMESPACE */
  1394. /** \def stlsoft_ns_qual(x)
  1395. * \brief Qualifies with <b>stlsoft::</b> if STLSoft is using namespaces or, if not, does not qualify
  1396. */
  1397. /** \def stlsoft_ns_using(x)
  1398. * \brief Declares a using directive (with respect to <b>stlsoft</b>) if STLSoft is using namespaces or, if not, does nothing
  1399. */
  1400. #if !defined(_STLSOFT_NO_NAMESPACE) || \
  1401. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  1402. # define stlsoft_ns_qual(x) ::stlsoft::x
  1403. # define stlsoft_ns_using(x) using ::stlsoft::x;
  1404. #else /* ? _STLSOFT_NO_NAMESPACE */
  1405. # define stlsoft_ns_qual(x) x
  1406. # define stlsoft_ns_using(x)
  1407. #endif /* !_STLSOFT_NO_NAMESPACE */
  1408. /** \def stlsoft_ns_qual_std(x)
  1409. * \brief Qualifies with <b>std::</b> if STLSoft is being translated in the context of the standard library being within the <b>std</b> namespace or, if not, does not qualify
  1410. */
  1411. /** \def stlsoft_ns_using_std(x)
  1412. * \brief Declares a using directive (with respect to <b>std</b>) if STLSoft is being translated in the context of the standard library being within the <b>std</b> namespace or, if not, does nothing
  1413. */
  1414. #if defined(STLSOFT_CF_std_NAMESPACE) || \
  1415. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  1416. # define stlsoft_ns_qual_std(x) ::std::x
  1417. # define stlsoft_ns_qual_std_(x) std::x
  1418. # define stlsoft_ns_using_std(x) using ::std::x;
  1419. #else /* ? STLSOFT_CF_std_NAMESPACE */
  1420. # define stlsoft_ns_qual_std(x) x
  1421. # define stlsoft_ns_using_std(x)
  1422. #endif /* !STLSOFT_CF_std_NAMESPACE */
  1423. /** \def STLSOFT_NS_GLOBAL(X)
  1424. * \brief Qualifies <b>X</b> with <b>::</b> if compiling C++, otherwise just resolves to X
  1425. */
  1426. #if defined(__cplusplus) || \
  1427. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  1428. # define STLSOFT_NS_GLOBAL(x) ::x
  1429. #else /* ? __cplusplus */
  1430. # define STLSOFT_NS_GLOBAL(x) x
  1431. #endif /* __cplusplus */
  1432. /* This stuff allows worker namespaces to be declared and used regardless of
  1433. * whether namespaces are supported and allowed
  1434. */
  1435. #if !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION) && \
  1436. !defined(_STLSOFT_NO_NAMESPACES)
  1437. # define STLSOFT_OPEN_WORKER_NS_(ns) namespace ns {
  1438. # define STLSOFT_CLOSE_WORKER_NS_(ns) }
  1439. # define STLSOFT_WORKER_NS_QUAL_(ns, x) ns::x
  1440. #else /* ? namespaces supported */
  1441. # define STLSOFT_OPEN_WORKER_NS_(ns)
  1442. # define STLSOFT_CLOSE_WORKER_NS_(ns)
  1443. # define STLSOFT_WORKER_NS_QUAL_(ns, x) x
  1444. #endif /* namespaces supported */
  1445. /* /////////////////////////////////////////////////////////////////////////
  1446. * 64-bit warning support
  1447. */
  1448. #if defined(STLSOFT_COMPILER_IS_MSVC) && \
  1449. _MSC_VER >= 1310 && \
  1450. !defined(_WIN64) && \
  1451. defined(_Wp64)
  1452. # define STLSOFT_WARN_64 __w64
  1453. #else /* ? compiler */
  1454. # define STLSOFT_WARN_64
  1455. #endif /* compiler */
  1456. /* /////////////////////////////////////////////////////////////////////////
  1457. * Typedefs
  1458. *
  1459. * The STLSoft uses a number of typedefs to aid in compiler-independence in the
  1460. * libraries' main code.
  1461. */
  1462. /* Type definitions - precursors */
  1463. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  1464. /* STLSOFT_CF_NATIVE_BOOL_SUPPORT */
  1465. # if defined(__STLSOFT_CF_NATIVE_BOOL_SUPPORT) && \
  1466. !defined(STLSOFT_CF_NATIVE_BOOL_SUPPORT)
  1467. # error Configuration error: deprecated symbol __STLSOFT_CF_NATIVE_BOOL_SUPPORT is defined when STLSOFT_CF_NATIVE_BOOL_SUPPORT is not!
  1468. # else /* ? STLSOFT_CF_INT_DISTINCT_INT_TYPE */
  1469. # ifdef STLSOFT_CF_NATIVE_BOOL_SUPPORT
  1470. # define __STLSOFT_CF_NATIVE_BOOL_SUPPORT
  1471. # endif /* STLSOFT_CF_NATIVE_BOOL_SUPPORT */
  1472. # endif /* STLSOFT_CF_NATIVE_BOOL_SUPPORT */
  1473. /* STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT */
  1474. # if defined(__STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT) && \
  1475. !defined(STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT)
  1476. # error Configuration error: deprecated symbol __STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT is defined when STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT is not!
  1477. # else /* ? STLSOFT_CF_INT_DISTINCT_INT_TYPE */
  1478. # ifdef STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT
  1479. # define __STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT
  1480. # endif /* STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT */
  1481. # endif /* STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT */
  1482. /* STLSOFT_CF_TYPEDEF_WCHAR_T_SUPPORT */
  1483. # if defined(__STLSOFT_CF_TYPEDEF_WCHAR_T_SUPPORT) && \
  1484. !defined(STLSOFT_CF_TYPEDEF_WCHAR_T_SUPPORT)
  1485. # error Configuration error: deprecated symbol __STLSOFT_CF_TYPEDEF_WCHAR_T_SUPPORT is defined when STLSOFT_CF_TYPEDEF_WCHAR_T_SUPPORT is not!
  1486. # else /* ? STLSOFT_CF_INT_DISTINCT_INT_TYPE */
  1487. # ifdef STLSOFT_CF_TYPEDEF_WCHAR_T_SUPPORT
  1488. # define __STLSOFT_CF_TYPEDEF_WCHAR_T_SUPPORT
  1489. # endif /* STLSOFT_CF_TYPEDEF_WCHAR_T_SUPPORT */
  1490. # endif /* STLSOFT_CF_TYPEDEF_WCHAR_T_SUPPORT */
  1491. /* STLSOFT_CF_INT_DISTINCT_INT_TYPE */
  1492. # if ( defined(STLSOFT_CF_INT_DISTINCT_TYPE) || \
  1493. defined(__STLSOFT_CF_INT_DISTINCT_TYPE)) && \
  1494. !defined(STLSOFT_CF_INT_DISTINCT_INT_TYPE)
  1495. # error Configuration error: one or both of the deprecated symbols STLSOFT_CF_INT_DISTINCT_TYPE or __STLSOFT_CF_INT_DISTINCT_TYPE is defined when STLSOFT_CF_INT_DISTINCT_INT_TYPE is not!
  1496. # else /* ? STLSOFT_CF_INT_DISTINCT_INT_TYPE */
  1497. # ifdef STLSOFT_CF_INT_DISTINCT_INT_TYPE
  1498. # define STLSOFT_CF_INT_DISTINCT_TYPE
  1499. # define __STLSOFT_CF_INT_DISTINCT_TYPE
  1500. # endif /* STLSOFT_CF_INT_DISTINCT_INT_TYPE */
  1501. # endif /* STLSOFT_CF_INT_DISTINCT_INT_TYPE */
  1502. /* STLSOFT_CF_LONG_DISTINCT_INT_TYPE */
  1503. # if ( defined(STLSOFT_CF_LONG_DISTINCT_TYPE) || \
  1504. defined(__STLSOFT_CF_LONG_DISTINCT_TYPE)) && \
  1505. !defined(STLSOFT_CF_LONG_DISTINCT_INT_TYPE)
  1506. # error Configuration error: one or both of the deprecated symbols STLSOFT_CF_LONG_DISTINCT_TYPE or __STLSOFT_CF_LONG_DISTINCT_TYPE is defined when STLSOFT_CF_LONG_DISTINCT_INT_TYPE is not!
  1507. # else /* ? STLSOFT_CF_LONG_DISTINCT_INT_TYPE */
  1508. # ifdef STLSOFT_CF_LONG_DISTINCT_INT_TYPE
  1509. # define STLSOFT_CF_LONG_DISTINCT_TYPE
  1510. # define __STLSOFT_CF_LONG_DISTINCT_TYPE
  1511. # endif /* STLSOFT_CF_LONG_DISTINCT_INT_TYPE */
  1512. # endif /* STLSOFT_CF_LONG_DISTINCT_INT_TYPE */
  1513. /* wchar_t
  1514. *
  1515. * wchar_t is either a built-in type, or is defined to an unsigned 16-bit value
  1516. */
  1517. #ifdef STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT
  1518. /* It's some kind of compiler native type. */
  1519. # ifndef STLSOFT_NATIVE_WCHAR_T
  1520. /* either wchar_t itself */
  1521. # define STLSOFT_WCHAR_T_BASE_TYPE_ wchar_t
  1522. # else /* ? STLSOFT_NATIVE_WCHAR_T */
  1523. /* or a compiler-specific type */
  1524. # define STLSOFT_WCHAR_T_BASE_TYPE_ STLSOFT_NATIVE_WCHAR_T
  1525. # endif /* !STLSOFT_NATIVE_WCHAR_T */
  1526. #elif defined(STLSOFT_CF_TYPEDEF_WCHAR_T_SUPPORT)
  1527. # define STLSOFT_WCHAR_T_BASE_TYPE_ wchar_t
  1528. #else /* ? wchar_t support */
  1529. /* It's some kind of library-defined type. */
  1530. # ifndef _STLSOFT_NO_STD_INCLUDES
  1531. # define STLSOFT_WCHAR_T_BASE_TYPE_ wchar_t
  1532. # else /* ? _STLSOFT_NO_STD_INCLUDES */
  1533. # define STLSOFT_WCHAR_T_BASE_TYPE_ unsigned short
  1534. # endif /* _STLSOFT_NO_STD_INCLUDES */
  1535. #endif /* !STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT */
  1536. /* 8-bit */
  1537. #ifdef STLSOFT_CF_8BIT_INT_SUPPORT
  1538. typedef STLSOFT_SI08_T_BASE_TYPE STLSOFT_I_08_T_BASE_TYPE_;
  1539. typedef STLSOFT_SI08_T_BASE_TYPE STLSOFT_SI08_T_BASE_TYPE_;
  1540. typedef STLSOFT_UI08_T_BASE_TYPE STLSOFT_UI08_T_BASE_TYPE_;
  1541. #else /* ? STLSOFT_CF_8BIT_INT_SUPPORT */
  1542. # error STLSoft requires 8-bit integer support
  1543. #endif /* STLSOFT_CF_8BIT_INT_SUPPORT */
  1544. /* 16-bit */
  1545. #ifdef STLSOFT_CF_16BIT_INT_SUPPORT
  1546. typedef STLSOFT_SI16_T_BASE_TYPE STLSOFT_I_16_T_BASE_TYPE_;
  1547. typedef STLSOFT_SI16_T_BASE_TYPE STLSOFT_SI16_T_BASE_TYPE_;
  1548. typedef STLSOFT_UI16_T_BASE_TYPE STLSOFT_UI16_T_BASE_TYPE_;
  1549. #else /* ? STLSOFT_CF_16BIT_INT_SUPPORT */
  1550. # error STLSoft requires 16-bit integer support
  1551. #endif /* STLSOFT_CF_16BIT_INT_SUPPORT */
  1552. /* 32-bit */
  1553. #ifdef STLSOFT_CF_32BIT_INT_SUPPORT
  1554. typedef STLSOFT_SI32_T_BASE_TYPE STLSOFT_I_32_T_BASE_TYPE_;
  1555. typedef STLSOFT_SI32_T_BASE_TYPE STLSOFT_SI32_T_BASE_TYPE_;
  1556. typedef STLSOFT_UI32_T_BASE_TYPE STLSOFT_UI32_T_BASE_TYPE_;
  1557. #else /* ? STLSOFT_CF_32BIT_INT_SUPPORT */
  1558. # error STLSoft requires 32-bit integer support
  1559. #endif /* STLSOFT_CF_32BIT_INT_SUPPORT */
  1560. /* 64-bit */
  1561. #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
  1562. typedef STLSOFT_SI64_T_BASE_TYPE STLSOFT_I_64_T_BASE_TYPE_;
  1563. typedef STLSOFT_SI64_T_BASE_TYPE STLSOFT_SI64_T_BASE_TYPE_;
  1564. typedef STLSOFT_UI64_T_BASE_TYPE STLSOFT_UI64_T_BASE_TYPE_;
  1565. #endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
  1566. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  1567. /* Type definitions - proper */
  1568. typedef char ss_char_a_t; /*!< Ansi char type */
  1569. typedef STLSOFT_WCHAR_T_BASE_TYPE_ ss_char_w_t; /*!< Unicode char type */
  1570. typedef STLSOFT_I_08_T_BASE_TYPE_ ss_int8_t; /*!< 8-bit integer */
  1571. typedef STLSOFT_SI08_T_BASE_TYPE_ ss_sint8_t; /*!< 8-bit signed integer */
  1572. typedef STLSOFT_UI08_T_BASE_TYPE_ ss_uint8_t; /*!< 8-bit unsigned integer */
  1573. typedef STLSOFT_I_16_T_BASE_TYPE_ ss_int16_t; /*!< 16-bit integer */
  1574. typedef STLSOFT_SI16_T_BASE_TYPE_ ss_sint16_t; /*!< 16-bit signed integer */
  1575. typedef STLSOFT_UI16_T_BASE_TYPE_ ss_uint16_t; /*!< 16-bit unsigned integer */
  1576. typedef STLSOFT_I_32_T_BASE_TYPE_ ss_int32_t; /*!< 32-bit integer */
  1577. typedef STLSOFT_SI32_T_BASE_TYPE_ ss_sint32_t; /*!< 32-bit signed integer */
  1578. typedef STLSOFT_UI32_T_BASE_TYPE_ ss_uint32_t; /*!< 32-bit unsigned integer */
  1579. #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
  1580. typedef STLSOFT_I_64_T_BASE_TYPE_ ss_int64_t; /*!< 64-bit integer */
  1581. typedef STLSOFT_SI64_T_BASE_TYPE_ ss_sint64_t; /*!< 64-bit signed integer */
  1582. typedef STLSOFT_UI64_T_BASE_TYPE_ ss_uint64_t; /*!< 64-bit unsigned integer */
  1583. #endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
  1584. typedef short ss_short_t; /*!< short integer */
  1585. typedef int STLSOFT_WARN_64 ss_int_t; /*!< integer */
  1586. typedef signed int STLSOFT_WARN_64 ss_sint_t; /*!< signed integer */
  1587. typedef unsigned int STLSOFT_WARN_64 ss_uint_t; /*!< unsigned integer */
  1588. typedef long STLSOFT_WARN_64 ss_long_t; /*!< long integer */
  1589. typedef unsigned long STLSOFT_WARN_64 ss_ulong_t; /*!< long integer */
  1590. typedef ss_uint8_t ss_byte_t; /*!< Byte */
  1591. #if defined(__cplusplus)
  1592. # ifdef STLSOFT_CF_NATIVE_BOOL_SUPPORT
  1593. typedef bool ss_bool_t; /*!< Boolean type */
  1594. # else /* ? STLSOFT_CF_NATIVE_BOOL_SUPPORT */
  1595. typedef unsigned int ss_bool_t;
  1596. # endif /* STLSOFT_CF_NATIVE_BOOL_SUPPORT */
  1597. #endif /* __cplusplus */
  1598. #ifndef _STLSOFT_NO_STD_INCLUDES
  1599. typedef ptrdiff_t ss_ptrdiff_t; /*!< ptr diff */
  1600. typedef size_t STLSOFT_WARN_64 ss_size_t; /*!< size */
  1601. #else /* ? _STLSOFT_NO_STD_INCLUDES */
  1602. typedef unsigned int STLSOFT_WARN_64 ss_size_t;
  1603. typedef int ss_ptrdiff_t;
  1604. #endif /* !_STLSOFT_NO_STD_INCLUDES */
  1605. typedef long ss_streampos_t; /*!< streampos */
  1606. typedef long ss_streamoff_t; /*!< streamoff */
  1607. #ifndef _STLSOFT_NO_NAMESPACE
  1608. typedef ss_char_a_t char_a_t; /*!< Ansi char type */
  1609. typedef ss_char_w_t char_w_t; /*!< Unicode char type */
  1610. typedef ss_int8_t int8_t; /*!< 8-bit integer */
  1611. typedef ss_sint8_t sint8_t; /*!< 8-bit signed integer */
  1612. typedef ss_uint8_t uint8_t; /*!< 8-bit unsigned integer */
  1613. typedef ss_int16_t int16_t; /*!< 16-bit integer */
  1614. typedef ss_sint16_t sint16_t; /*!< 16-bit signed integer */
  1615. typedef ss_uint16_t uint16_t; /*!< 16-bit unsigned integer */
  1616. typedef ss_int32_t int32_t; /*!< 32-bit integer */
  1617. typedef ss_sint32_t sint32_t; /*!< 32-bit signed integer */
  1618. typedef ss_uint32_t uint32_t; /*!< 32-bit unsigned integer */
  1619. # ifdef STLSOFT_CF_64BIT_INT_SUPPORT
  1620. typedef ss_int64_t int64_t; /*!< 64-bit integer */
  1621. typedef ss_sint64_t sint64_t; /*!< 64-bit signed integer */
  1622. typedef ss_uint64_t uint64_t; /*!< 64-bit unsigned integer */
  1623. # endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
  1624. typedef ss_short_t short_t; /*!< short integer */
  1625. typedef ss_int_t STLSOFT_WARN_64 int_t; /*!< integer */
  1626. typedef ss_sint_t STLSOFT_WARN_64 sint_t; /*!< signed integer */
  1627. typedef ss_uint_t STLSOFT_WARN_64 uint_t; /*!< unsigned integer */
  1628. typedef ss_long_t STLSOFT_WARN_64 long_t; /*!< long integer */
  1629. typedef ss_byte_t byte_t; /*!< Byte */
  1630. # if defined(__cplusplus)
  1631. typedef ss_bool_t bool_t; /*!< bool */
  1632. # endif /* __cplusplus */
  1633. # if !defined(STLSOFT_COMPILER_IS_DMC)
  1634. typedef ss_streampos_t streampos_t; /*!< streampos */
  1635. typedef ss_streamoff_t streamoff_t; /*!< streamoff */
  1636. # endif /* compiler */
  1637. #endif /* !_STLSOFT_NO_NAMESPACE */
  1638. #if 0
  1639. template <ss_size_t N>
  1640. struct uintp_traits;
  1641. STLSOFT_GEN_TRAIT_SPECIALISATION
  1642. struct uintp_traits<1>
  1643. {
  1644. typedef uint8_t unsigned_type;
  1645. }
  1646. typedef size_traits<sizeof(void*)>::signed_type sintp_t;
  1647. typedef size_traits<sizeof(void*)>::unsigned_type uintp_t;
  1648. #endif /* 0 */
  1649. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  1650. # if defined(__cplusplus)
  1651. struct native_wchar_t_checker
  1652. {
  1653. /* Character types. */
  1654. void check(char)
  1655. {}
  1656. #ifdef STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT
  1657. void check(wchar_t)
  1658. {}
  1659. #endif /* STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT */
  1660. /* Sized integer types. */
  1661. void check(ss_sint8_t)
  1662. {}
  1663. void check(ss_uint8_t)
  1664. {}
  1665. void check(ss_sint16_t)
  1666. {}
  1667. void check(ss_uint16_t)
  1668. {}
  1669. void check(ss_sint32_t)
  1670. {}
  1671. void check(ss_uint32_t)
  1672. {}
  1673. #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
  1674. void check(ss_sint64_t)
  1675. {}
  1676. void check(ss_uint64_t)
  1677. {}
  1678. #endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
  1679. /* Natural integer types. */
  1680. #ifdef STLSOFT_CF_CHAR_DISTINCT_INT_TYPE
  1681. void check(signed char)
  1682. {}
  1683. void check(unsigned char)
  1684. {}
  1685. #endif /* STLSOFT_CF_CHAR_DISTINCT_INT_TYPE */
  1686. #ifdef STLSOFT_CF_SHORT_DISTINCT_INT_TYPE
  1687. void check(signed short)
  1688. {}
  1689. void check(unsigned short)
  1690. {}
  1691. #endif /* STLSOFT_CF_SHORT_DISTINCT_INT_TYPE */
  1692. #ifdef STLSOFT_CF_INT_DISTINCT_INT_TYPE
  1693. void check(signed int)
  1694. {}
  1695. void check(unsigned int)
  1696. {}
  1697. #endif /* STLSOFT_CF_INT_DISTINCT_INT_TYPE */
  1698. #ifdef STLSOFT_CF_LONG_DISTINCT_INT_TYPE
  1699. void check(signed long)
  1700. {}
  1701. void check(unsigned long)
  1702. {}
  1703. #endif /* STLSOFT_CF_LONG_DISTINCT_INT_TYPE */
  1704. ~native_wchar_t_checker()
  1705. {
  1706. /* Character types. */
  1707. check(char());
  1708. check(wchar_t());
  1709. /* Sized integer types. */
  1710. check(ss_sint8_t());
  1711. check(ss_uint8_t());
  1712. check(ss_sint16_t());
  1713. check(ss_uint16_t());
  1714. check(ss_sint32_t());
  1715. check(ss_uint32_t());
  1716. #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
  1717. check(ss_sint64_t());
  1718. check(ss_uint64_t());
  1719. #endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
  1720. /* Natural integer types. */
  1721. check(static_cast<signed char>(0));
  1722. check(static_cast<unsigned char>(0));
  1723. check(static_cast<signed short>(0));
  1724. check(static_cast<unsigned short>(0));
  1725. check(static_cast<signed int>(0));
  1726. check(static_cast<unsigned int>(0));
  1727. check(static_cast<signed long>(0));
  1728. check(static_cast<unsigned long>(0));
  1729. }
  1730. };
  1731. struct stlsoft_size_checker
  1732. {
  1733. # ifdef STLSOFT_COMPILER_IS_GCC
  1734. protected: /* GCC is too "helpful" in this case, so must declare as protected */
  1735. # else /* ? compiler */
  1736. private:
  1737. # endif /* compiler */
  1738. stlsoft_size_checker();
  1739. ~stlsoft_size_checker()
  1740. {
  1741. /* Char types */
  1742. STLSOFT_STATIC_ASSERT(sizeof(ss_char_a_t) >= 1);
  1743. STLSOFT_STATIC_ASSERT(sizeof(ss_char_w_t) >= 2);
  1744. /* 8-bit types */
  1745. STLSOFT_STATIC_ASSERT(sizeof(ss_int8_t) == 1);
  1746. STLSOFT_STATIC_ASSERT(sizeof(ss_sint8_t) == sizeof(ss_int8_t));
  1747. STLSOFT_STATIC_ASSERT(sizeof(ss_uint8_t) == sizeof(ss_int8_t));
  1748. /* 16-bit types */
  1749. STLSOFT_STATIC_ASSERT(sizeof(ss_int16_t) == 2);
  1750. STLSOFT_STATIC_ASSERT(sizeof(ss_sint16_t) == sizeof(ss_int16_t));
  1751. STLSOFT_STATIC_ASSERT(sizeof(ss_uint16_t) == sizeof(ss_int16_t));
  1752. /* 32-bit types */
  1753. STLSOFT_STATIC_ASSERT(sizeof(ss_int32_t) == 4);
  1754. STLSOFT_STATIC_ASSERT(sizeof(ss_sint32_t) == sizeof(ss_int32_t));
  1755. STLSOFT_STATIC_ASSERT(sizeof(ss_uint32_t) == sizeof(ss_int32_t));
  1756. /* 64-bit types */
  1757. # ifdef STLSOFT_CF_64BIT_INT_SUPPORT
  1758. STLSOFT_STATIC_ASSERT(sizeof(ss_int64_t) == 8);
  1759. STLSOFT_STATIC_ASSERT(sizeof(ss_sint64_t) == sizeof(ss_int64_t));
  1760. STLSOFT_STATIC_ASSERT(sizeof(ss_uint64_t) == sizeof(ss_int64_t));
  1761. # endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
  1762. /* Integer types */
  1763. STLSOFT_STATIC_ASSERT(sizeof(ss_int_t) >= 1);
  1764. STLSOFT_STATIC_ASSERT(sizeof(ss_sint_t) == sizeof(ss_int_t));
  1765. STLSOFT_STATIC_ASSERT(sizeof(ss_uint_t) == sizeof(ss_int_t));
  1766. STLSOFT_STATIC_ASSERT(sizeof(ss_long_t) >= sizeof(ss_int_t));
  1767. /* byte type */
  1768. STLSOFT_STATIC_ASSERT(sizeof(ss_byte_t) == 1);
  1769. /* Boolean type */
  1770. STLSOFT_STATIC_ASSERT(sizeof(ss_bool_t) >= 1);
  1771. /* Other types */
  1772. STLSOFT_STATIC_ASSERT(sizeof(ss_size_t) >= 1);
  1773. STLSOFT_STATIC_ASSERT(sizeof(ss_ptrdiff_t) >= 1);
  1774. STLSOFT_STATIC_ASSERT(sizeof(ss_streampos_t) >= 1);
  1775. STLSOFT_STATIC_ASSERT(sizeof(ss_streamoff_t) >= 1);
  1776. }
  1777. };
  1778. # endif /* __cplusplus */
  1779. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  1780. /* /////////////////////////////////////////////////////////////////////////
  1781. * Keywords
  1782. *
  1783. * The STLSoft uses a number of preprocessor symbols to aid in compiler
  1784. * compatibility in the libraries' code.
  1785. *
  1786. * ss_explicit_k - explicit, or nothing
  1787. * ss_mutable_k - mutable, or nothing
  1788. * ss_typename_type_k - typename, or nothing (used within template
  1789. * definitions for declaring types derived from
  1790. * externally derived types)
  1791. * ss_typename_param_k - typename or class (used for template parameters)
  1792. * ss_typename_type_def_k - typename qualifier in template default parameters
  1793. * ss_typename_type_mil_k - typename qualifier in constructor initialiser lists
  1794. * ss_typename_type_ret_k - typename qualifier in return types
  1795. */
  1796. /** \defgroup pseudo_keyword_macros Pseudo-keyword Macros
  1797. * \ingroup group__project__stlsoft
  1798. * \brief These macros are used to handle difference in support of certain keywords between translators
  1799. * @{
  1800. */
  1801. /** \def ss_explicit_k
  1802. *
  1803. * \brief Evaluates to <b>explicit</b> on translators that support the keyword, otherwise to nothing.
  1804. */
  1805. #if defined(STLSOFT_CF_EXPLICIT_KEYWORD_SUPPORT) || \
  1806. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  1807. # define ss_explicit_k explicit
  1808. #else /* ? STLSOFT_CF_EXPLICIT_KEYWORD_SUPPORT */
  1809. # define ss_explicit_k
  1810. #endif /* STLSOFT_CF_EXPLICIT_KEYWORD_SUPPORT */
  1811. /** \def ss_mutable_k
  1812. *
  1813. * \brief Evaluates to <b>mutable</b> on translators that support the keyword, otherwise to nothing.
  1814. */
  1815. #if defined(STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT) || \
  1816. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  1817. # define ss_mutable_k mutable
  1818. #else /* ? STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT */
  1819. # define ss_mutable_k
  1820. #endif /* STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT */
  1821. /** \def ss_typename_param_k
  1822. *
  1823. * \brief Evaluates to <b>typename</b> on translators that support the keyword, otherwise to <b>class</b>
  1824. *
  1825. * Used for template parameter declarations
  1826. */
  1827. #if defined(STLSOFT_CF_TYPENAME_PARAM_KEYWORD_SUPPORT) || \
  1828. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  1829. # define ss_typename_param_k typename
  1830. #else /* ? STLSOFT_CF_TYPENAME_PARAM_KEYWORD_SUPPORT */
  1831. # define ss_typename_param_k class
  1832. #endif /* STLSOFT_CF_TYPENAME_PARAM_KEYWORD_SUPPORT */
  1833. /** \def ss_typename_type_k
  1834. *
  1835. * \brief Evaluates to <b>typename</b> on translators that support the keyword, otherwise to nothing.
  1836. *
  1837. * Used for type disambiguation inside template bodies
  1838. */
  1839. #if defined(STLSOFT_CF_TYPENAME_TYPE_KEYWORD_SUPPORT) || \
  1840. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  1841. # define ss_typename_type_k typename
  1842. #else /* ? STLSOFT_CF_TYPENAME_TYPE_KEYWORD_SUPPORT */
  1843. # define ss_typename_type_k
  1844. #endif /* STLSOFT_CF_TYPENAME_TYPE_KEYWORD_SUPPORT */
  1845. /** \def ss_typename_type_def_k
  1846. *
  1847. * \brief Evaluates to <b>typename</b> on translators that support the keyword and its application in
  1848. * the context of default template arguments, otherwise to nothing.
  1849. *
  1850. * Used for type disambiguation in default template arguments
  1851. */
  1852. #if defined(STLSOFT_CF_TYPENAME_TYPE_DEF_KEYWORD_SUPPORT) || \
  1853. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  1854. # define ss_typename_type_def_k typename
  1855. #else /* ? STLSOFT_CF_TYPENAME_TYPE_DEF_KEYWORD_SUPPORT */
  1856. # define ss_typename_type_def_k
  1857. #endif /* STLSOFT_CF_TYPENAME_TYPE_DEF_KEYWORD_SUPPORT */
  1858. /** \def ss_typename_type_mil_k
  1859. *
  1860. * \brief Evaluates to <b>typename</b> on translators that support the keyword and its application in
  1861. * the context of member initialisation lists, otherwise to nothing.
  1862. *
  1863. * Used for type disambiguation inside initialiser lists in class template constructors
  1864. */
  1865. #if defined(STLSOFT_CF_TYPENAME_TYPE_MIL_KEYWORD_SUPPORT) || \
  1866. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  1867. # define ss_typename_type_mil_k typename
  1868. #else /* ? STLSOFT_CF_TYPENAME_TYPE_MIL_KEYWORD_SUPPORT */
  1869. # define ss_typename_type_mil_k
  1870. #endif /* STLSOFT_CF_TYPENAME_TYPE_MIL_KEYWORD_SUPPORT */
  1871. /** \def ss_typename_type_ret_k
  1872. *
  1873. * \brief Evaluates to <b>typename</b> on translators that support the keyword and its application in
  1874. * the context of member function/method return types, otherwise to nothing.
  1875. *
  1876. * Used for type disambiguation the return types in templates
  1877. */
  1878. #if defined(STLSOFT_CF_TYPENAME_TYPE_RET_KEYWORD_SUPPORT) || \
  1879. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  1880. # define ss_typename_type_ret_k typename
  1881. #else /* ? STLSOFT_CF_TYPENAME_TYPE_RET_KEYWORD_SUPPORT */
  1882. # define ss_typename_type_ret_k
  1883. #endif /* STLSOFT_CF_TYPENAME_TYPE_RET_KEYWORD_SUPPORT */
  1884. /** \def ss_template_qual_k
  1885. *
  1886. * \brief Evaluates to <b>template</b> on translators that support its use for type qualification
  1887. */
  1888. #if defined(STLSOFT_CF_TEMPLATE_QUALIFIER_KEYWORD_SUPPORT) || \
  1889. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  1890. # define ss_template_qual_k template
  1891. #else /* ? STLSOFT_CF_TEMPLATE_QUALIFIER_KEYWORD_SUPPORT */
  1892. # define ss_template_qual_k
  1893. #endif /* STLSOFT_CF_TEMPLATE_QUALIFIER_KEYWORD_SUPPORT */
  1894. /** @} */
  1895. /* /////////////////////////////////////////////////////////////////////////
  1896. * Values
  1897. *
  1898. * Since the boolean type may not be supported natively on all compilers, the
  1899. * values of true and false may also not be provided. Hence the values of
  1900. * ss_true_v and ss_false_v are defined, and are used in all code.
  1901. */
  1902. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  1903. #ifdef STLSOFT_CF_NATIVE_BOOL_SUPPORT
  1904. # define ss_true_v (true)
  1905. # define ss_false_v (false)
  1906. #else /* ? STLSOFT_CF_NATIVE_BOOL_SUPPORT */
  1907. # define ss_true_v (1)
  1908. # define ss_false_v (0)
  1909. #endif /* STLSOFT_CF_NATIVE_BOOL_SUPPORT */
  1910. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  1911. /* /////////////////////////////////////////////////////////////////////////
  1912. * Exception signature macro(s)
  1913. */
  1914. #ifdef __cplusplus
  1915. /** \brief Throws the given exception
  1916. *
  1917. * \note This is needed because Visual C++ 5.0 goes into an infinite loop if
  1918. * the exception instance is passed to throw. The apparent workaround
  1919. * (which only took me six years to discover!) is to apply *& to the
  1920. * instance.
  1921. */
  1922. # if defined(STLSOFT_COMPILER_IS_BORLAND)
  1923. template <ss_typename_param_k X>
  1924. inline void throw_x(X const& x) /* throw(X) */
  1925. {
  1926. X x2(x);
  1927. throw x2;
  1928. }
  1929. # define STLSOFT_THROW_X(x) stlsoft_ns_qual(throw_x)(x)
  1930. # else
  1931. template <ss_typename_param_k X>
  1932. inline void throw_x(X const& x)
  1933. # if defined(STLSOFT_COMPILER_IS_MSVC) && \
  1934. _MSC_VER < 1200
  1935. {
  1936. X const* px = &x;
  1937. throw *px;
  1938. }
  1939. # else /* ? compiler */
  1940. {
  1941. throw x;
  1942. }
  1943. # endif /* compiler */
  1944. # define STLSOFT_THROW_X(x) stlsoft_ns_qual(throw_x)(x)
  1945. # endif /* compiler */
  1946. #endif /* __cplusplus */
  1947. /** \defgroup group__project__stlsoft__code_modification_macros Code Modification Macros
  1948. * \ingroup group__project__stlsoft
  1949. * \brief These macros are used to help out where compiler differences are
  1950. * so great as to cause great disgusting messes in the class/function implementations
  1951. * @{
  1952. */
  1953. /** \def stlsoft_throw_0
  1954. * \brief Indicates that the given function/method does not throw any exceptions.
  1955. */
  1956. /** \def stlsoft_throw_1
  1957. * \brief Indicates that the given function/method throws the named type.
  1958. */
  1959. /** \def stlsoft_throw_2
  1960. * \brief Indicates that the given function/method throws the two named types.
  1961. */
  1962. /** \def stlsoft_throw_3
  1963. * \brief Indicates that the given function/method throws the three named types.
  1964. */
  1965. /** \def stlsoft_throw_4
  1966. * \brief Indicates that the given function/method throws the four named types.
  1967. */
  1968. /** \def stlsoft_throw_5
  1969. * \brief Indicates that the given function/method throws the five named types.
  1970. */
  1971. /** \def stlsoft_throw_6
  1972. * \brief Indicates that the given function/method throws the six named types.
  1973. */
  1974. /** \def stlsoft_throw_7
  1975. * \brief Indicates that the given function/method throws the seven named types.
  1976. */
  1977. /** \def stlsoft_throw_8
  1978. * \brief Indicates that the given function/method throws the eight named types.
  1979. */
  1980. /* Exception signatures. */
  1981. #if !defined(STLSOFT_NO_USE_EXCEPTION_SPECIFICATIONS) && \
  1982. !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION) && \
  1983. ( defined(STLSOFT_USE_EXCEPTION_SPECIFICATIONS) || \
  1984. defined(STLSOFT_CF_EXCEPTION_SIGNATURE_SUPPORT))
  1985. # ifndef STLSOFT_USE_EXCEPTION_SPECIFICATIONS
  1986. # define STLSOFT_USE_EXCEPTION_SPECIFICATIONS
  1987. # endif /* !STLSOFT_USE_EXCEPTION_SPECIFICATIONS */
  1988. # define stlsoft_throw_0() throw ()
  1989. # define stlsoft_throw_1(x1) throw (x1)
  1990. # define stlsoft_throw_2(x1, x2) throw (x1, x2)
  1991. # define stlsoft_throw_3(x1, x2, x3) throw (x1, x2, x3)
  1992. # define stlsoft_throw_4(x1, x2, x3, x4) throw (x1, x2, x3, x4)
  1993. # define stlsoft_throw_5(x1, x2, x3, x4, x5) throw (x1, x2, x3, x4, x5)
  1994. # define stlsoft_throw_6(x1, x2, x3, x4, x5, x6) throw (x1, x2, x3, x4, x5, x6)
  1995. # define stlsoft_throw_7(x1, x2, x3, x4, x5, x6, x7) throw (x1, x2, x3, x4, x5, x6, x7)
  1996. # define stlsoft_throw_8(x1, x2, x3, x4, x5, x6, x7, x8) throw (x1, x2, x3, x4, x5, x6, x7, x8)
  1997. #else /* ? exception specifications */
  1998. # ifdef STLSOFT_USE_EXCEPTION_SPECIFICATIONS
  1999. # undef STLSOFT_USE_EXCEPTION_SPECIFICATIONS
  2000. # endif /* STLSOFT_USE_EXCEPTION_SPECIFICATIONS */
  2001. # define stlsoft_throw_0()
  2002. # define stlsoft_throw_1(x1)
  2003. # define stlsoft_throw_2(x1, x2)
  2004. # define stlsoft_throw_3(x1, x2, x3)
  2005. # define stlsoft_throw_4(x1, x2, x3, x4)
  2006. # define stlsoft_throw_5(x1, x2, x3, x4, x5)
  2007. # define stlsoft_throw_6(x1, x2, x3, x4, x5, x6)
  2008. # define stlsoft_throw_7(x1, x2, x3, x4, x5, x6, x7)
  2009. # define stlsoft_throw_8(x1, x2, x3, x4, x5, x6, x7, x8)
  2010. #endif /* STLSOFT_CF_EXCEPTION_SIGNATURE_SUPPORT && !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  2011. /* /////////////////////////////////////////////////////////////////////////
  2012. * Array size determination macro(s)
  2013. */
  2014. /** \def STLSOFT_NUM_ELEMENTS(ar)
  2015. *
  2016. * \brief Evaluates, at compile time, to the number of elements within the given vector entity
  2017. *
  2018. * \param ar The array
  2019. *
  2020. * Is it used as follows:
  2021. *
  2022. \code
  2023. int ai[20];
  2024. int i = 32;
  2025. int *pi = &i;
  2026. std::vector<int> vi;
  2027. size_t s_ai = STLSOFT_NUM_ELEMENTS(ai); // Ok
  2028. size_t s_i = STLSOFT_NUM_ELEMENTS(i); // Error
  2029. size_t s_pi = STLSOFT_NUM_ELEMENTS(pi); // Error
  2030. size_t s_vi = STLSOFT_NUM_ELEMENTS(vi); // Error
  2031. \endcode
  2032. *
  2033. * \note For most of the supported compilers, this macro will reject application to pointer
  2034. * types, or to class types providing <code>operator []</code>. This helps to avoid the common
  2035. * gotcha whereby <code>(sizeof(ar) / sizeof(ar[0]))</code> is applied to such types, without
  2036. * causing a compiler error.
  2037. *
  2038. * \note From STLSoft 1.8.3 onwards, the underlying ss_static_array_size function is changed to return reference to const
  2039. * ss_array_size_struct, rather than ss_array_size_struct, so as to avoid Visual C++ (7.1)'s C4686 warning
  2040. */
  2041. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  2042. # define STLSOFT_NUM_ELEMENTS_(ar) (sizeof(ar) / sizeof(0[(ar)]))
  2043. # if defined(__cplusplus) && \
  2044. defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
  2045. # if 0/* defined(STLSOFT_COMPILER_IS_GCC) */
  2046. # pragma pack(push, 1)
  2047. template <int N>
  2048. struct ss_array_size_struct
  2049. {
  2050. ss_byte_t c[N];
  2051. };
  2052. # pragma pack(pop)
  2053. template <class T, int N>
  2054. ss_array_size_struct<N> const& ss_static_array_size(T (&)[N]);
  2055. # define STLSOFT_NUM_ELEMENTS(ar) sizeof(stlsoft_ns_qual(ss_static_array_size)(ar))
  2056. # else /* ? 0 */
  2057. template <int N>
  2058. struct ss_array_size_struct
  2059. {
  2060. ss_byte_t c[N];
  2061. };
  2062. template <class T, int N>
  2063. ss_array_size_struct<N> const& ss_static_array_size(T (&)[N]);
  2064. #if defined(STLSOFT_COMPILER_IS_VECTORC)
  2065. template <class T, int N>
  2066. ss_array_size_struct<N> const& ss_static_array_size(T const (&)[N]);
  2067. #endif /* compiler */
  2068. # define STLSOFT_NUM_ELEMENTS(ar) sizeof(stlsoft_ns_qual(ss_static_array_size)(ar).c)
  2069. # endif /* 0 */
  2070. # else /* ? __cplusplus && STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */
  2071. # define STLSOFT_NUM_ELEMENTS(ar) STLSOFT_NUM_ELEMENTS_(ar)
  2072. # endif /* __cplusplus && STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */
  2073. #else /* ? STLSOFT_DOCUMENTATION_SKIP_SECTION */
  2074. # define STLSOFT_NUM_ELEMENTS(ar)
  2075. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  2076. /** \def stlsoft_num_elements(ar)
  2077. *
  2078. * \brief Evaluates, at compile time, to the number of elements within the given vector entity
  2079. *
  2080. * \param ar The array
  2081. *
  2082. * \deprecated This is deprecated in favour of \ref STLSOFT_NUM_ELEMENTS().
  2083. *
  2084. * \note This is a simple \#define for STLSOFT_NUM_ELEMENTS()
  2085. */
  2086. #define stlsoft_num_elements(ar) STLSOFT_NUM_ELEMENTS(ar)
  2087. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  2088. # define stlsoft_num_elements_(ar) STLSOFT_NUM_ELEMENTS_(ar)
  2089. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  2090. /* /////////////////////////////////////////////////////////////////////////
  2091. * Structure element access macro(s)
  2092. */
  2093. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  2094. # define STLSOFT_RAW_OFFSETOF_1(S, M) \
  2095. \
  2096. stlsoft_static_cast( \
  2097. \
  2098. stlsoft_ns_qual(ss_size_t), \
  2099. \
  2100. stlsoft_reinterpret_cast( \
  2101. stlsoft_ns_qual(ss_ptrdiff_t), \
  2102. stlsoft_reinterpret_cast(char const*, \
  2103. & \
  2104. ( stlsoft_reinterpret_cast(S*, stlsoft_static_cast(char*, 1)) /* Cast 0 to S */ \
  2105. + 1) /* Add 1 */ \
  2106. ->M) /* Take M addr */ \
  2107. ) \
  2108. - \
  2109. stlsoft_reinterpret_cast( \
  2110. stlsoft_ns_qual(ss_ptrdiff_t), \
  2111. stlsoft_reinterpret_cast(char const*, \
  2112. ( stlsoft_reinterpret_cast(S*, stlsoft_static_cast(char*, 1)) /* Cast 0 to S */ \
  2113. + 1)) /* Add 1 */ \
  2114. ) \
  2115. )
  2116. # define STLSOFT_RAW_OFFSETOF_2(S, M) \
  2117. \
  2118. (reinterpret_cast<stlsoft_ns_qual(ss_size_t)>(&reinterpret_cast<S*>(1)->M) - 1)
  2119. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  2120. /** \def STLSOFT_RAW_OFFSETOF(S, M)
  2121. *
  2122. * \brief Evaluates, at compile time, the offset of the member \c m in the structure \c s
  2123. *
  2124. * \param S The type of the structure/class
  2125. * \param M The name of the member
  2126. */
  2127. #if defined(RECLS_COMPILER_IS_GCC)
  2128. # define STLSOFT_RAW_OFFSETOF(S, M) STLSOFT_RAW_OFFSETOF_2(S, M)
  2129. #elif defined(_STLSOFT_NO_STD_INCLUDES)
  2130. # define STLSOFT_RAW_OFFSETOF(S, M) offsetof(S, M)
  2131. #else /* ? _STLSOFT_NO_STD_INCLUDES */
  2132. # define STLSOFT_RAW_OFFSETOF(S, M) stlsoft_reinterpret_cast(stlsoft_ns_qual(ss_size_t), &stlsoft_static_cast(S*, 0)->M)
  2133. #endif /* !_STLSOFT_NO_STD_INCLUDES */
  2134. /** \def stlsoft_raw_offsetof(s, m)
  2135. *
  2136. * \brief Evaluates, at compile time, the offset of a structure/class member
  2137. *
  2138. * \deprecated This is deprecated in favour of \ref STLSOFT_RAW_OFFSETOF().
  2139. *
  2140. * \note This is a simple \#define for STLSOFT_RAW_OFFSETOF()
  2141. */
  2142. #define stlsoft_raw_offsetof(s, m) STLSOFT_RAW_OFFSETOF(s, m)
  2143. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  2144. # ifdef STLSOFT_CF_USE_RAW_OFFSETOF_IN_STATIC_ASSERT
  2145. # undef STLSOFT_CF_USE_RAW_OFFSETOF_IN_STATIC_ASSERT
  2146. # endif /* STLSOFT_CF_USE_RAW_OFFSETOF_IN_STATIC_ASSERT */
  2147. # if !defined(STLSOFT_COMPILER_IS_COMO) && \
  2148. !defined(STLSOFT_COMPILER_IS_GCC) && \
  2149. !defined(STLSOFT_COMPILER_IS_INTEL) && \
  2150. !defined(STLSOFT_COMPILER_IS_WATCOM)
  2151. # define STLSOFT_CF_USE_RAW_OFFSETOF_IN_STATIC_ASSERT
  2152. # endif /* compiler */
  2153. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  2154. /* /////////////////////////////////////////////////////////////////////////
  2155. * Destruction function(s)/macro(s)
  2156. */
  2157. /* destroy function */
  2158. #if defined(__cplusplus)
  2159. # ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  2160. template <ss_typename_param_k T>
  2161. inline void stlsoft_destroy_instance_fn(T *p)
  2162. {
  2163. p->~T();
  2164. /* SSCB: Borland C++ and Visual C++ remove the dtor for basic
  2165. * structs, and then warn that p is unused. This reference
  2166. * suppresses that warning.
  2167. */
  2168. #if defined(STLSOFT_COMPILER_IS_WATCOM)
  2169. p = p;
  2170. #else /* ? compiler */
  2171. static_cast<void>(p);
  2172. #endif /* compiler */
  2173. }
  2174. # endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  2175. /** \def STLSOFT_DESTROY_INSTANCE(T1, T2, P)
  2176. *
  2177. * \param T1 The type to be destroyed, as a template parameter (e.g. T)
  2178. * \param T2 The type to be destroyed, as a typedef (e.g. value_type)
  2179. * \param P Pointer (T*) to the instance to be explicitly destroyed
  2180. *
  2181. * Destroys the given instance \c P of the given type (\c T1 and \c T2)
  2182. */
  2183. # if defined(STLSOFT_DOCUMENTATION_SKIP_SECTION) || \
  2184. defined(STLSOFT_COMPILER_IS_DMC)
  2185. # define STLSOFT_DESTROY_INSTANCE(T1, T2, P) do { (P)->~T1(); } while(0)
  2186. # else /* ? compiler */
  2187. # define STLSOFT_DESTROY_INSTANCE(T1, T2, P) stlsoft_ns_qual(stlsoft_destroy_instance_fn)((P))
  2188. # endif /* compiler */
  2189. #endif /* __cplusplus */
  2190. /** \def stlsoft_destroy_instance(T1, T2, P)
  2191. *
  2192. * \brief Explicitly destroys an instance
  2193. *
  2194. * \deprecated This is deprecated in favour of \ref STLSOFT_DESTROY_INSTANCE().
  2195. *
  2196. * \note This is a simple \#define for STLSOFT_DESTROY_INSTANCE()
  2197. */
  2198. #define stlsoft_destroy_instance(T1, T2, P) STLSOFT_DESTROY_INSTANCE(T1, T2, P)
  2199. /* /////////////////////////////////////////////////////////////////////////
  2200. * Handle generator macro(s)
  2201. */
  2202. /** \brief Generates an opaque type with the name \c type
  2203. *
  2204. * For example, the following defines two distinct opaque types:
  2205. *
  2206. \code
  2207. STLSOFT_GEN_OPAQUE(HThread)
  2208. STLSOFT_GEN_OPAQUE(HProcess)
  2209. \endcode
  2210. *
  2211. * The two types are incompatible with each other, and with any other types (except that
  2212. * they are both convertible to <code>void const*</code>
  2213. */
  2214. #define STLSOFT_GEN_OPAQUE(type) typedef struct __stlsoft_htype##type{ int i;} const* type;
  2215. /** \def stlsoft_gen_opaque(Type)
  2216. *
  2217. * \brief Generates an opaque type with the name \c Type
  2218. *
  2219. * \deprecated This is deprecated in favour of \ref STLSOFT_GEN_OPAQUE().
  2220. *
  2221. * \note This is a simple \#define for STLSOFT_GEN_OPAQUE()
  2222. */
  2223. #define stlsoft_gen_opaque(Type) STLSOFT_GEN_OPAQUE(Type)
  2224. /* /////////////////////////////////////////////////////////////////////////
  2225. * Template friend macro(s)
  2226. */
  2227. /** \def STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND
  2228. * \ingroup group__project__stlsoft__code_modification_macros
  2229. *
  2230. * \brief Declares a template (class) parameter to be a friend of the template.
  2231. *
  2232. * Is it used as follows:
  2233. *
  2234. \code
  2235. template<typename T>
  2236. class Thing
  2237. {
  2238. STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(T);
  2239. private:
  2240. int m_member; // Thing<T>::m_member visible to T
  2241. };
  2242. \endcode
  2243. *
  2244. * \note This is contrary to the C++-98 standard. Section 7.1.5.3(2) notes: <i>"...within a class
  2245. * template with a template type-parameter T, the declaration ["]friend class T;["] is ill-formed."</i>
  2246. * However, it gives the expected behaviour for all compilers currently supported by STLSoft
  2247. */
  2248. #if defined(STLSOFT_DOCUMENTATION_SKIP_SECTION) || \
  2249. defined(STLSOFT_COMPILER_IS_BORLAND) || \
  2250. defined(STLSOFT_COMPILER_IS_COMO) || \
  2251. defined(STLSOFT_COMPILER_IS_DMC) || \
  2252. ( defined(STLSOFT_COMPILER_IS_GCC) && \
  2253. __GNUC__ < 3) || \
  2254. defined(STLSOFT_COMPILER_IS_INTEL) || \
  2255. defined(STLSOFT_COMPILER_IS_MSVC) || \
  2256. defined(STLSOFT_COMPILER_IS_VECTORC) || \
  2257. defined(STLSOFT_COMPILER_IS_SUNPRO) || \
  2258. defined(STLSOFT_COMPILER_IS_WATCOM)
  2259. # define STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(T) friend T
  2260. #elif defined(STLSOFT_COMPILER_IS_MWERKS)
  2261. # define STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(T) friend class T
  2262. #elif defined(STLSOFT_COMPILER_IS_GCC) && \
  2263. __GNUC__ >= 3
  2264. # if __GNUC__ >= 4 || \
  2265. ( __GNUC__ == 3 && \
  2266. __GNUC_MINOR__ >= 3 && \
  2267. !defined(__APPLE__))
  2268. /* This version of the technique for GCC 3.3+ was suggested by Lars Rune N�stdal,
  2269. * from Norway. Many thanks, Lars!
  2270. */
  2271. # define STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(T) \
  2272. \
  2273. struct friend_maker \
  2274. { \
  2275. typedef T T2; \
  2276. }; \
  2277. \
  2278. friend class friend_maker::T2
  2279. # else /* ? __GNUC_MINOR__ */
  2280. # define STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(T) \
  2281. \
  2282. struct friend_maker \
  2283. { \
  2284. typedef T T2; \
  2285. }; \
  2286. \
  2287. typedef typename friend_maker::T2 friend_type; \
  2288. \
  2289. friend friend_type
  2290. # endif /* __GNUC_MINOR__ */
  2291. #else /* ? compiler */
  2292. # error Compiler not discriminated
  2293. #endif /* compiler */
  2294. /* /////////////////////////////////////////////////////////////////////////
  2295. * Code suppression macro(s)
  2296. */
  2297. /** \def STLSOFT_SUPPRESS_UNUSED
  2298. * \ingroup group__project__stlsoft__code_modification_macros
  2299. *
  2300. * \brief Used to suppress unused variable warnings
  2301. */
  2302. #if defined(__cplusplus) && \
  2303. ( defined(STLSOFT_COMPILER_IS_COMO) || \
  2304. /* defined(STLSOFT_COMPILER_IS_DMCx) || */ \
  2305. ( defined(STLSOFT_COMPILER_IS_GCC) && \
  2306. __GNUC__ >= 3) || \
  2307. defined(STLSOFT_COMPILER_IS_INTEL) || \
  2308. defined(STLSOFT_COMPILER_IS_WATCOM))
  2309. template<ss_typename_param_k T>
  2310. inline void suppress_unused_func(T const volatile &)
  2311. {}
  2312. # if defined(STLSOFT_CF_CDECL_SUPPORTED)
  2313. template<ss_typename_param_k R>
  2314. inline void suppress_unused_func(R (STLSOFT_CDECL *)())
  2315. {}
  2316. template<ss_typename_param_k R, ss_typename_param_k A0>
  2317. inline void suppress_unused_func(R (STLSOFT_CDECL *)(A0))
  2318. {}
  2319. # endif /* STLSOFT_CF_CDECL_SUPPORTED */
  2320. # if defined(STLSOFT_CF_FASTCALL_SUPPORTED)
  2321. template<ss_typename_param_k R>
  2322. inline void suppress_unused_func(R (STLSOFT_FASTCALL *)())
  2323. {}
  2324. template<ss_typename_param_k R, ss_typename_param_k A0>
  2325. inline void suppress_unused_func(R (STLSOFT_FASTCALL *)(A0))
  2326. {}
  2327. # endif /* STLSOFT_CF_FASTCALL_SUPPORTED */
  2328. # if defined(STLSOFT_CF_STDCALL_SUPPORTED)
  2329. template<ss_typename_param_k R>
  2330. inline void suppress_unused_func(R (STLSOFT_STDCALL *)())
  2331. {}
  2332. template<ss_typename_param_k R, ss_typename_param_k A0>
  2333. inline void suppress_unused_func(R (STLSOFT_STDCALL *)(A0))
  2334. {}
  2335. # endif /* STLSOFT_CF_STDCALL_SUPPORTED */
  2336. # define STLSOFT_SUPPRESS_UNUSED(x) stlsoft_ns_qual(suppress_unused_func)(x)
  2337. #else /* ? compiler */
  2338. # ifdef __cplusplus
  2339. # define STLSOFT_SUPPRESS_UNUSED(x) (static_cast<void>(x))
  2340. # else /* ? __cplusplus */
  2341. # define STLSOFT_SUPPRESS_UNUSED(x) ((void)(x))
  2342. # endif /* __cplusplus */
  2343. #endif /* compiler */
  2344. /** \def STLSOFT_UNNAMED_PARAM
  2345. * \ingroup group__project__stlsoft__code_modification_macros
  2346. *
  2347. * \brief Used to define an unused parameter for C compilation and/or documentation processing, but not for C++ compilation
  2348. */
  2349. #if defined(__cplusplus) && \
  2350. !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  2351. # define STLSOFT_UNNAMED_PARAM(p)
  2352. #else /* ? __cplusplus */
  2353. # define STLSOFT_UNNAMED_PARAM(p) p
  2354. #endif /* __cplusplus */
  2355. /** \def STLSOFT_SUPPRESS_UNNAMED_PARAM
  2356. * \ingroup group__project__stlsoft__code_modification_macros
  2357. *
  2358. * \brief Used to suppress unused parameter warnings (in C compilation) for parameters defined by STLSOFT_UNNAMED_PARAM()
  2359. */
  2360. #if defined(__cplusplus) && \
  2361. !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  2362. # define STLSOFT_SUPPRESS_UNNAMED_PARAM(p)
  2363. #else /* ? __cplusplus */
  2364. # define STLSOFT_SUPPRESS_UNNAMED_PARAM(p) ((void)p);
  2365. #endif /* __cplusplus */
  2366. /** @} */
  2367. /* /////////////////////////////////////////////////////////////////////////
  2368. * Cast macro(s)
  2369. */
  2370. /** \defgroup cast_macros Cast Macros
  2371. * \ingroup group__project__stlsoft
  2372. * \brief These macros abstract casts, representing the C++ casts in C++ compilation
  2373. * units, and C-casts in C compilation units
  2374. * @{
  2375. */
  2376. /** \def stlsoft_c_cast(T, E)
  2377. * \brief C-cast macro; equivalent to ((T)(E)), but more searchable
  2378. */
  2379. #define stlsoft_c_cast(T, E) ((T)(E))
  2380. /** \def stlsoft_static_cast(T, E)
  2381. * \brief C-cast macro; equivalent to <code>static_cast<T, E></code> in C++, and stlsoft_c_cast(T, E) in C
  2382. */
  2383. /** \def stlsoft_const_cast(T, E)
  2384. * \brief C-cast macro; equivalent to <code>const_cast<T, E></code> in C++, and stlsoft_c_cast(T, E) in C
  2385. */
  2386. /** \def stlsoft_volatile_cast(T, E)
  2387. * \brief C-cast macro; equivalent to <code>const_cast<T, E></code> in C++, and stlsoft_c_cast(T, E) in C
  2388. */
  2389. /** \def stlsoft_reinterpret_cast(T, E)
  2390. * \brief C-cast macro; equivalent to <code>reinterpret_cast<T, E></code> in C++, and stlsoft_c_cast(T, E) in C
  2391. */
  2392. /** \def stlsoft_dynamic_cast(T, E)
  2393. * \brief C-cast macro; equivalent to <code>dynamic_cast<T, E></code> in C++, and stlsoft_c_cast(T, E) in C
  2394. */
  2395. #if defined(__cplusplus)
  2396. # define stlsoft_static_cast(T, E) static_cast< T>(E)
  2397. #else /* ? __cplusplus */
  2398. # define stlsoft_static_cast(T, E) stlsoft_c_cast(T, E)
  2399. #endif /* __cplusplus */
  2400. #if defined(__cplusplus)
  2401. # define stlsoft_const_cast(T, E) const_cast< T>(E)
  2402. #else /* ? __cplusplus */
  2403. # define stlsoft_const_cast(T, E) stlsoft_c_cast(T, E)
  2404. #endif /* __cplusplus */
  2405. #if defined(__cplusplus)
  2406. # define stlsoft_volatile_cast(T, E) const_cast< T>(E)
  2407. #else /* ? __cplusplus */
  2408. # define stlsoft_volatile_cast(T, E) stlsoft_c_cast(T, E)
  2409. #endif /* __cplusplus */
  2410. #if defined(__cplusplus)
  2411. # define stlsoft_reinterpret_cast(T, E) reinterpret_cast< T>(E)
  2412. #else /* ? __cplusplus */
  2413. # define stlsoft_reinterpret_cast(T, E) stlsoft_c_cast(T, E)
  2414. #endif /* __cplusplus */
  2415. #if defined(__cplusplus)
  2416. # define stlsoft_dynamic_cast(T, E) dynamic_cast< T>(E)
  2417. #else /* ? __cplusplus */
  2418. # define stlsoft_dynamic_cast(T, E) stlsoft_c_cast(T, E)
  2419. #endif /* __cplusplus */
  2420. /** @} */
  2421. /* /////////////////////////////////////////////////////////////////////////
  2422. * Inlining macro(s)
  2423. */
  2424. /** \defgroup inlining_macros Inlining Macros
  2425. * \ingroup group__project__stlsoft
  2426. * \brief These macros abstract inline
  2427. * @{
  2428. */
  2429. /** \def STLSOFT_INLINE
  2430. * \brief inline pseudo-keyword
  2431. *
  2432. * Resolves to \c inline in C++ compilation. In C, resolves to \c inline for
  2433. * compilers that support C99, or otherwise \c STLSOFT_CUSTOM_C_INLINE if
  2434. * defined, or otherwise defaults to \c static
  2435. */
  2436. #if defined(__cplusplus)
  2437. # define STLSOFT_INLINE inline
  2438. #else /* ? __cplusplus */
  2439. # if defined(STLSOFT_CF_C99_INLINE)
  2440. # define STLSOFT_INLINE inline
  2441. # elif defined(STLSOFT_CUSTOM_C_INLINE)
  2442. # define STLSOFT_INLINE STLSOFT_CUSTOM_C_INLINE
  2443. # else /* ? C inline */
  2444. # define STLSOFT_INLINE static
  2445. # endif /* C inline */
  2446. #endif /* __cplusplus */
  2447. /** @} */
  2448. /* /////////////////////////////////////////////////////////////////////////
  2449. * Sanity checks - 4
  2450. *
  2451. * This section checks that the discriminated sizes of various types are
  2452. * correct.
  2453. */
  2454. #ifdef STLSOFT_CF_STATIC_ASSERT_SUPPORT
  2455. # ifdef __cplusplus
  2456. namespace internal_gcc
  2457. {
  2458. # endif /* __cplusplus */
  2459. # if defined(__cplusplus) /* || defined(STLSOFT_CF_C99_INLINE) */
  2460. STLSOFT_INLINE void _stlsoft_internal_verify_integral_type_sizes(void)
  2461. {
  2462. STLSOFT_STATIC_ASSERT(_STLSOFT_SIZEOF_CHAR == sizeof(char));
  2463. STLSOFT_STATIC_ASSERT(_STLSOFT_SIZEOF_SHORT == sizeof(short));
  2464. STLSOFT_STATIC_ASSERT(_STLSOFT_SIZEOF_INT == sizeof(int));
  2465. STLSOFT_STATIC_ASSERT(_STLSOFT_SIZEOF_LONG == sizeof(long));
  2466. # ifdef STLSOFT_CF_BUILTIN_long_long_SUPPORT
  2467. STLSOFT_STATIC_ASSERT(_STLSOFT_SIZEOF_LONG_LONG == sizeof(long long));
  2468. # endif /* STLSOFT_CF_BUILTIN_long_long_SUPPORT */
  2469. STLSOFT_STATIC_ASSERT(1 == sizeof(ss_sint8_t));
  2470. STLSOFT_STATIC_ASSERT(1 == sizeof(ss_uint8_t));
  2471. STLSOFT_STATIC_ASSERT(2 == sizeof(ss_sint16_t));
  2472. STLSOFT_STATIC_ASSERT(2 == sizeof(ss_uint16_t));
  2473. STLSOFT_STATIC_ASSERT(4 == sizeof(ss_sint32_t));
  2474. STLSOFT_STATIC_ASSERT(4 == sizeof(ss_uint32_t));
  2475. # ifdef STLSOFT_CF_64BIT_INT_SUPPORT
  2476. STLSOFT_STATIC_ASSERT(8 == sizeof(ss_sint64_t));
  2477. STLSOFT_STATIC_ASSERT(8 == sizeof(ss_uint64_t));
  2478. # endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
  2479. }
  2480. # endif /* __cplusplus) || STLSOFT_CF_C99_INLINE */
  2481. # ifdef __cplusplus
  2482. } /* namespace internal_gcc */
  2483. # endif /* __cplusplus */
  2484. #endif /* STLSOFT_CF_STATIC_ASSERT_SUPPORT */
  2485. /* /////////////////////////////////////////////////////////////////////////
  2486. * Pointer manipulation functions(s)
  2487. */
  2488. /** \defgroup pointer_manipulation_functions Pointer Manipulation Functions
  2489. * \ingroup group__project__stlsoft
  2490. * \brief These functions assist in calculations with, and the manipulation of, pointers
  2491. * @{
  2492. */
  2493. /** \brief Offsets a pointer by a number of bytes
  2494. *
  2495. * \param p The pointer to be offset
  2496. * \param n The number of bytes to offset
  2497. * \result \c p offset by \c bytes, expressed as <code>void const*</code>
  2498. */
  2499. #if defined(__cplusplus)
  2500. template <ss_typename_param_k T>
  2501. inline
  2502. void
  2503. const*
  2504. ptr_byte_offset(
  2505. T const p
  2506. , ss_ptrdiff_t n
  2507. )
  2508. {
  2509. # if 0
  2510. # if !defined(STLSOFT_COMPILER_IS_BORLAND) && \
  2511. ( !defined(STLSOFT_COMPILER_IS_MSVC) || \
  2512. _MSC_VER > 1200)
  2513. struct InternalPointerChecker
  2514. {
  2515. public:
  2516. static void check(void mutable *)
  2517. {}
  2518. static void check(void const mutable *)
  2519. {}
  2520. template <ss_typename_param_k T2>
  2521. static void check(T2 p)
  2522. {
  2523. ss_size_t n = sizeof(p[0]);
  2524. STLSOFT_SUPPRESS_UNUSED(n);
  2525. }
  2526. };
  2527. /* Check it's a pointer */
  2528. InternalPointerChecker::check(p);
  2529. # endif /* compiler */
  2530. # endif /* 0 */
  2531. void const* p1 = static_cast<void const*>(p);
  2532. ss_byte_t const* p2 = static_cast<ss_byte_t const*>(p1);
  2533. ss_byte_t const* p3 = p2 + n;
  2534. void const* p4 = static_cast<void const*>(p3);
  2535. void const* p5 = static_cast<void const*>(p);
  2536. STLSOFT_ASSERT((static_cast<char const*>(p4) - static_cast<char const*>(p5)) == n);
  2537. STLSOFT_SUPPRESS_UNUSED(p5); /* VC++ 7.1 can't see this. ?? */
  2538. return p4;
  2539. }
  2540. /** \brief Offsets a pointer by a number of elements
  2541. *
  2542. * \param p The pointer to be offset
  2543. * \param n The number of elements to offset
  2544. * \result \c p offset by \c elements
  2545. */
  2546. template <ss_typename_param_k T>
  2547. inline
  2548. T const*
  2549. ptr_offset(
  2550. T const* p
  2551. , ss_ptrdiff_t n
  2552. )
  2553. {
  2554. return p + n;
  2555. }
  2556. /** \brief Get the difference in bytes between two pointers
  2557. */
  2558. template<
  2559. ss_typename_param_k T1
  2560. , ss_typename_param_k T2
  2561. >
  2562. inline
  2563. ss_ptrdiff_t
  2564. ptr_byte_diff(
  2565. T1 const* p1
  2566. , T2 const* p2
  2567. )
  2568. {
  2569. return static_cast<ss_byte_t const*>(static_cast<void const*>(p1)) - static_cast<ss_byte_t const*>(static_cast<void const*>(p2));
  2570. }
  2571. /** \brief Get the difference in elements between two pointers
  2572. */
  2573. template<
  2574. ss_typename_param_k T1
  2575. , ss_typename_param_k T2
  2576. >
  2577. inline
  2578. ss_ptrdiff_t
  2579. ptr_diff(
  2580. T1 const* p1
  2581. , T2 const* p2
  2582. )
  2583. {
  2584. return p1 - p2;
  2585. }
  2586. #endif /* __cplusplus */
  2587. /** @} end of group pointer_manipulation_functions */
  2588. /* /////////////////////////////////////////////////////////////////////////
  2589. * cv qualifier functions(s)
  2590. */
  2591. /** \defgroup cv_qualifier_functions cv-Qualifier Functions
  2592. * \ingroup group__project__stlsoft
  2593. * \brief These functions assist in the manipulation of cv-qualifiers
  2594. * @{
  2595. */
  2596. #if defined(__cplusplus)
  2597. /** \brief Remove const-qualifier from an instance.
  2598. *
  2599. * \warning Using this function can result in undefined behaviour. As such,
  2600. * the advice is: <b>Use With Care!</b>
  2601. */
  2602. template <ss_typename_param_k T>
  2603. inline
  2604. T&
  2605. remove_const(T const& t)
  2606. {
  2607. return const_cast<T&>(t);
  2608. }
  2609. /** \brief Remove const-qualifier from an instance.
  2610. *
  2611. * \warning Using this function can result in undefined behaviour. As such,
  2612. * the advice is: <b>Use With Care!</b>
  2613. */
  2614. template <ss_typename_param_k T>
  2615. inline
  2616. T*
  2617. remove_const_ptr(T const* t)
  2618. {
  2619. return const_cast<T*>(t);
  2620. }
  2621. /** \brief Adds const-qualifier to an instance.
  2622. */
  2623. template <ss_typename_param_k T>
  2624. inline
  2625. T const&
  2626. apply_const(T& t)
  2627. {
  2628. return t;
  2629. }
  2630. /** \brief Adds const-qualifier to an instance.
  2631. */
  2632. template <ss_typename_param_k T>
  2633. inline
  2634. T const*
  2635. apply_const_ptr(T* t)
  2636. {
  2637. return t;
  2638. }
  2639. /* Mutable support */
  2640. # ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  2641. template <ss_typename_param_k T>
  2642. # ifdef STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT
  2643. inline T& mutable_access(T& t)
  2644. # else /* ? STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT */
  2645. inline T& mutable_access(T const& t)
  2646. # endif /* STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT */
  2647. {
  2648. # ifdef STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT
  2649. return t;
  2650. # else /* ? STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT */
  2651. return const_cast<T&>(t);
  2652. # endif /* STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT */
  2653. }
  2654. # endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  2655. /* Move constructor support */
  2656. # ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  2657. # ifdef STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT
  2658. # define stlsoft_define_move_rhs_type(t) t &
  2659. # else /* ? STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT */
  2660. # define stlsoft_define_move_rhs_type(t) t const&
  2661. # endif /* STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT */
  2662. template <ss_typename_param_k T>
  2663. inline T& move_lhs_from_rhs(stlsoft_define_move_rhs_type(T) t)
  2664. {
  2665. # ifdef STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT
  2666. return t;
  2667. # else /* ? STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT */
  2668. return const_cast<T&>(t);
  2669. # endif /* STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT */
  2670. }
  2671. # endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  2672. /** \brief Takes the address of a variable
  2673. *
  2674. * \warning This function is used to take the address of a variable,
  2675. * possibly a temporary, and allows the code to skip the reasonable
  2676. * reservations of compilers to not want to compile code that uses the
  2677. * address of temporaries. As such, the advice is: <b>Use With Care!</b>
  2678. */
  2679. template <ss_typename_param_k T>
  2680. inline T const* address(T const& t)
  2681. {
  2682. return &t;
  2683. }
  2684. #endif /* __cplusplus */
  2685. /** @} */
  2686. /* /////////////////////////////////////////////////////////////////////////
  2687. * Memory
  2688. */
  2689. #if defined(__cplusplus)
  2690. /* function operator new
  2691. *
  2692. * When namespaces are being used, stlsoft provides its own placement new,
  2693. * otherwise it includes <new> in order to access the global version.
  2694. */
  2695. #ifndef new
  2696. # ifdef _STLSOFT_NO_NAMESPACE
  2697. # if defined(STLSOFT_COMPILER_IS_BORLAND) && \
  2698. __BORLANDC__ < 0x0550
  2699. # include <new.h>
  2700. # else /* ? compiler */
  2701. # include <new>
  2702. # endif /* compiler */
  2703. # else /* ? _STLSOFT_NO_NAMESPACE */
  2704. # if ( defined(STLSOFT_COMPILER_IS_DMC) && \
  2705. __DMC__ < 0x0833) || \
  2706. ( defined(STLSOFT_COMPILER_IS_MSVC) && \
  2707. _MSC_VER < 1300)
  2708. inline void *operator new(ss_size_t /* si */, void *pv)
  2709. {
  2710. return pv;
  2711. }
  2712. # endif /* compiler */
  2713. # endif /* !_STLSOFT_NO_NAMESPACE */
  2714. #endif /* !new */
  2715. #endif /* __cplusplus */
  2716. /* ////////////////////////////////////////////////////////////////////// */
  2717. #ifndef _STLSOFT_NO_NAMESPACE
  2718. } /* namespace stlsoft */
  2719. #endif /* !_STLSOFT_NO_NAMESPACE */
  2720. /* /////////////////////////////////////////////////////////////////////////
  2721. * Inclusion
  2722. */
  2723. #ifdef STLSOFT_CF_PRAGMA_ONCE_SUPPORT
  2724. # pragma once
  2725. #endif /* STLSOFT_CF_PRAGMA_ONCE_SUPPORT */
  2726. /* /////////////////////////////////////////////////////////////////////////
  2727. * Unit-testing
  2728. */
  2729. #ifdef STLSOFT_UNITTEST
  2730. # ifndef STLSOFT_INCL_UNITTEST_HPP_UNITTEST
  2731. # include <unittest/unittest.hpp>
  2732. # endif /* !STLSOFT_INCL_UNITTEST_HPP_UNITTEST */
  2733. # if defined(STLSOFT_COMPILER_IS_MSVC) && \
  2734. _MSC_VER == 1200
  2735. # include <stlsoft/synch/concepts.hpp> /* Avoids a VC6 ICE. */
  2736. # endif /* compiler */
  2737. #endif /* STLSOFT_UNITTEST */
  2738. /* ////////////////////////////////////////////////////////////////////// */
  2739. #endif /* !STLSOFT_INCL_STLSOFT_H_STLSOFT */
  2740. /* ///////////////////////////// end of file //////////////////////////// */