benchmark_util.hpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. // Copyright Szabolcs Toth (thszabi@gmail.com) 2016.
  2. // Copyright Abel Sinkovics (abel@sinkovics.hu) 2016.
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #include <boost/metaparse/string.hpp>
  7. template <char C>
  8. struct to_upper_char;
  9. template <> struct to_upper_char<-128> : boost::mpl::char_<95> {};
  10. template <> struct to_upper_char<-127> : boost::mpl::char_<96> {};
  11. template <> struct to_upper_char<-126> : boost::mpl::char_<97> {};
  12. template <> struct to_upper_char<-125> : boost::mpl::char_<98> {};
  13. template <> struct to_upper_char<-124> : boost::mpl::char_<99> {};
  14. template <> struct to_upper_char<-123> : boost::mpl::char_<100> {};
  15. template <> struct to_upper_char<-122> : boost::mpl::char_<101> {};
  16. template <> struct to_upper_char<-121> : boost::mpl::char_<102> {};
  17. template <> struct to_upper_char<-120> : boost::mpl::char_<103> {};
  18. template <> struct to_upper_char<-119> : boost::mpl::char_<104> {};
  19. template <> struct to_upper_char<-118> : boost::mpl::char_<105> {};
  20. template <> struct to_upper_char<-117> : boost::mpl::char_<106> {};
  21. template <> struct to_upper_char<-116> : boost::mpl::char_<107> {};
  22. template <> struct to_upper_char<-115> : boost::mpl::char_<108> {};
  23. template <> struct to_upper_char<-114> : boost::mpl::char_<109> {};
  24. template <> struct to_upper_char<-113> : boost::mpl::char_<110> {};
  25. template <> struct to_upper_char<-112> : boost::mpl::char_<111> {};
  26. template <> struct to_upper_char<-111> : boost::mpl::char_<112> {};
  27. template <> struct to_upper_char<-110> : boost::mpl::char_<113> {};
  28. template <> struct to_upper_char<-109> : boost::mpl::char_<114> {};
  29. template <> struct to_upper_char<-108> : boost::mpl::char_<115> {};
  30. template <> struct to_upper_char<-107> : boost::mpl::char_<116> {};
  31. template <> struct to_upper_char<-106> : boost::mpl::char_<117> {};
  32. template <> struct to_upper_char<-105> : boost::mpl::char_<118> {};
  33. template <> struct to_upper_char<-104> : boost::mpl::char_<119> {};
  34. template <> struct to_upper_char<-103> : boost::mpl::char_<120> {};
  35. template <> struct to_upper_char<-102> : boost::mpl::char_<121> {};
  36. template <> struct to_upper_char<-101> : boost::mpl::char_<122> {};
  37. template <> struct to_upper_char<-100> : boost::mpl::char_<123> {};
  38. template <> struct to_upper_char<-99> : boost::mpl::char_<124> {};
  39. template <> struct to_upper_char<-98> : boost::mpl::char_<125> {};
  40. template <> struct to_upper_char<-97> : boost::mpl::char_<126> {};
  41. template <> struct to_upper_char<-96> : boost::mpl::char_<127> {};
  42. template <> struct to_upper_char<-95> : boost::mpl::char_<-127> {};
  43. template <> struct to_upper_char<-94> : boost::mpl::char_<-126> {};
  44. template <> struct to_upper_char<-93> : boost::mpl::char_<-125> {};
  45. template <> struct to_upper_char<-92> : boost::mpl::char_<-124> {};
  46. template <> struct to_upper_char<-91> : boost::mpl::char_<-123> {};
  47. template <> struct to_upper_char<-90> : boost::mpl::char_<-122> {};
  48. template <> struct to_upper_char<-89> : boost::mpl::char_<-121> {};
  49. template <> struct to_upper_char<-88> : boost::mpl::char_<-120> {};
  50. template <> struct to_upper_char<-87> : boost::mpl::char_<-119> {};
  51. template <> struct to_upper_char<-86> : boost::mpl::char_<-118> {};
  52. template <> struct to_upper_char<-85> : boost::mpl::char_<-117> {};
  53. template <> struct to_upper_char<-84> : boost::mpl::char_<-116> {};
  54. template <> struct to_upper_char<-83> : boost::mpl::char_<-115> {};
  55. template <> struct to_upper_char<-82> : boost::mpl::char_<-114> {};
  56. template <> struct to_upper_char<-81> : boost::mpl::char_<-113> {};
  57. template <> struct to_upper_char<-80> : boost::mpl::char_<-112> {};
  58. template <> struct to_upper_char<-79> : boost::mpl::char_<-111> {};
  59. template <> struct to_upper_char<-78> : boost::mpl::char_<-110> {};
  60. template <> struct to_upper_char<-77> : boost::mpl::char_<-109> {};
  61. template <> struct to_upper_char<-76> : boost::mpl::char_<-108> {};
  62. template <> struct to_upper_char<-75> : boost::mpl::char_<-107> {};
  63. template <> struct to_upper_char<-74> : boost::mpl::char_<-106> {};
  64. template <> struct to_upper_char<-73> : boost::mpl::char_<-105> {};
  65. template <> struct to_upper_char<-72> : boost::mpl::char_<-104> {};
  66. template <> struct to_upper_char<-71> : boost::mpl::char_<-103> {};
  67. template <> struct to_upper_char<-70> : boost::mpl::char_<-102> {};
  68. template <> struct to_upper_char<-69> : boost::mpl::char_<-101> {};
  69. template <> struct to_upper_char<-68> : boost::mpl::char_<-100> {};
  70. template <> struct to_upper_char<-67> : boost::mpl::char_<-99> {};
  71. template <> struct to_upper_char<-66> : boost::mpl::char_<-98> {};
  72. template <> struct to_upper_char<-65> : boost::mpl::char_<-97> {};
  73. template <> struct to_upper_char<-64> : boost::mpl::char_<-96> {};
  74. template <> struct to_upper_char<-63> : boost::mpl::char_<-95> {};
  75. template <> struct to_upper_char<-62> : boost::mpl::char_<-94> {};
  76. template <> struct to_upper_char<-61> : boost::mpl::char_<-93> {};
  77. template <> struct to_upper_char<-60> : boost::mpl::char_<-92> {};
  78. template <> struct to_upper_char<-59> : boost::mpl::char_<-91> {};
  79. template <> struct to_upper_char<-58> : boost::mpl::char_<-90> {};
  80. template <> struct to_upper_char<-57> : boost::mpl::char_<-89> {};
  81. template <> struct to_upper_char<-56> : boost::mpl::char_<-88> {};
  82. template <> struct to_upper_char<-55> : boost::mpl::char_<-87> {};
  83. template <> struct to_upper_char<-54> : boost::mpl::char_<-86> {};
  84. template <> struct to_upper_char<-53> : boost::mpl::char_<-85> {};
  85. template <> struct to_upper_char<-52> : boost::mpl::char_<-84> {};
  86. template <> struct to_upper_char<-51> : boost::mpl::char_<-83> {};
  87. template <> struct to_upper_char<-50> : boost::mpl::char_<-82> {};
  88. template <> struct to_upper_char<-49> : boost::mpl::char_<-81> {};
  89. template <> struct to_upper_char<-48> : boost::mpl::char_<-80> {};
  90. template <> struct to_upper_char<-47> : boost::mpl::char_<-79> {};
  91. template <> struct to_upper_char<-46> : boost::mpl::char_<-78> {};
  92. template <> struct to_upper_char<-45> : boost::mpl::char_<-77> {};
  93. template <> struct to_upper_char<-44> : boost::mpl::char_<-76> {};
  94. template <> struct to_upper_char<-43> : boost::mpl::char_<-75> {};
  95. template <> struct to_upper_char<-42> : boost::mpl::char_<-74> {};
  96. template <> struct to_upper_char<-41> : boost::mpl::char_<-73> {};
  97. template <> struct to_upper_char<-40> : boost::mpl::char_<-72> {};
  98. template <> struct to_upper_char<-39> : boost::mpl::char_<-71> {};
  99. template <> struct to_upper_char<-38> : boost::mpl::char_<-70> {};
  100. template <> struct to_upper_char<-37> : boost::mpl::char_<-69> {};
  101. template <> struct to_upper_char<-36> : boost::mpl::char_<-68> {};
  102. template <> struct to_upper_char<-35> : boost::mpl::char_<-67> {};
  103. template <> struct to_upper_char<-34> : boost::mpl::char_<-66> {};
  104. template <> struct to_upper_char<-33> : boost::mpl::char_<-65> {};
  105. template <> struct to_upper_char<-32> : boost::mpl::char_<-64> {};
  106. template <> struct to_upper_char<-31> : boost::mpl::char_<-63> {};
  107. template <> struct to_upper_char<-30> : boost::mpl::char_<-62> {};
  108. template <> struct to_upper_char<-29> : boost::mpl::char_<-61> {};
  109. template <> struct to_upper_char<-28> : boost::mpl::char_<-60> {};
  110. template <> struct to_upper_char<-27> : boost::mpl::char_<-59> {};
  111. template <> struct to_upper_char<-26> : boost::mpl::char_<-58> {};
  112. template <> struct to_upper_char<-25> : boost::mpl::char_<-57> {};
  113. template <> struct to_upper_char<-24> : boost::mpl::char_<-56> {};
  114. template <> struct to_upper_char<-23> : boost::mpl::char_<-55> {};
  115. template <> struct to_upper_char<-22> : boost::mpl::char_<-54> {};
  116. template <> struct to_upper_char<-21> : boost::mpl::char_<-53> {};
  117. template <> struct to_upper_char<-20> : boost::mpl::char_<-52> {};
  118. template <> struct to_upper_char<-19> : boost::mpl::char_<-51> {};
  119. template <> struct to_upper_char<-18> : boost::mpl::char_<-50> {};
  120. template <> struct to_upper_char<-17> : boost::mpl::char_<-49> {};
  121. template <> struct to_upper_char<-16> : boost::mpl::char_<-48> {};
  122. template <> struct to_upper_char<-15> : boost::mpl::char_<-47> {};
  123. template <> struct to_upper_char<-14> : boost::mpl::char_<-46> {};
  124. template <> struct to_upper_char<-13> : boost::mpl::char_<-45> {};
  125. template <> struct to_upper_char<-12> : boost::mpl::char_<-44> {};
  126. template <> struct to_upper_char<-11> : boost::mpl::char_<-43> {};
  127. template <> struct to_upper_char<-10> : boost::mpl::char_<-42> {};
  128. template <> struct to_upper_char<-9> : boost::mpl::char_<-41> {};
  129. template <> struct to_upper_char<-8> : boost::mpl::char_<-40> {};
  130. template <> struct to_upper_char<-7> : boost::mpl::char_<-39> {};
  131. template <> struct to_upper_char<-6> : boost::mpl::char_<-38> {};
  132. template <> struct to_upper_char<-5> : boost::mpl::char_<-37> {};
  133. template <> struct to_upper_char<-4> : boost::mpl::char_<-36> {};
  134. template <> struct to_upper_char<-3> : boost::mpl::char_<-35> {};
  135. template <> struct to_upper_char<-2> : boost::mpl::char_<-34> {};
  136. template <> struct to_upper_char<-1> : boost::mpl::char_<-33> {};
  137. template <> struct to_upper_char<0> : boost::mpl::char_<-32> {};
  138. template <> struct to_upper_char<1> : boost::mpl::char_<-31> {};
  139. template <> struct to_upper_char<2> : boost::mpl::char_<-30> {};
  140. template <> struct to_upper_char<3> : boost::mpl::char_<-29> {};
  141. template <> struct to_upper_char<4> : boost::mpl::char_<-28> {};
  142. template <> struct to_upper_char<5> : boost::mpl::char_<-27> {};
  143. template <> struct to_upper_char<6> : boost::mpl::char_<-26> {};
  144. template <> struct to_upper_char<7> : boost::mpl::char_<-25> {};
  145. template <> struct to_upper_char<8> : boost::mpl::char_<-24> {};
  146. template <> struct to_upper_char<9> : boost::mpl::char_<-23> {};
  147. template <> struct to_upper_char<10> : boost::mpl::char_<-22> {};
  148. template <> struct to_upper_char<11> : boost::mpl::char_<-21> {};
  149. template <> struct to_upper_char<12> : boost::mpl::char_<-20> {};
  150. template <> struct to_upper_char<13> : boost::mpl::char_<-19> {};
  151. template <> struct to_upper_char<14> : boost::mpl::char_<-18> {};
  152. template <> struct to_upper_char<15> : boost::mpl::char_<-17> {};
  153. template <> struct to_upper_char<16> : boost::mpl::char_<-16> {};
  154. template <> struct to_upper_char<17> : boost::mpl::char_<-15> {};
  155. template <> struct to_upper_char<18> : boost::mpl::char_<-14> {};
  156. template <> struct to_upper_char<19> : boost::mpl::char_<-13> {};
  157. template <> struct to_upper_char<20> : boost::mpl::char_<-12> {};
  158. template <> struct to_upper_char<21> : boost::mpl::char_<-11> {};
  159. template <> struct to_upper_char<22> : boost::mpl::char_<-10> {};
  160. template <> struct to_upper_char<23> : boost::mpl::char_<-9> {};
  161. template <> struct to_upper_char<24> : boost::mpl::char_<-8> {};
  162. template <> struct to_upper_char<25> : boost::mpl::char_<-7> {};
  163. template <> struct to_upper_char<26> : boost::mpl::char_<-6> {};
  164. template <> struct to_upper_char<27> : boost::mpl::char_<-5> {};
  165. template <> struct to_upper_char<28> : boost::mpl::char_<-4> {};
  166. template <> struct to_upper_char<29> : boost::mpl::char_<-3> {};
  167. template <> struct to_upper_char<30> : boost::mpl::char_<-2> {};
  168. template <> struct to_upper_char<31> : boost::mpl::char_<-1> {};
  169. template <> struct to_upper_char<32> : boost::mpl::char_<0> {};
  170. template <> struct to_upper_char<33> : boost::mpl::char_<1> {};
  171. template <> struct to_upper_char<34> : boost::mpl::char_<2> {};
  172. template <> struct to_upper_char<35> : boost::mpl::char_<3> {};
  173. template <> struct to_upper_char<36> : boost::mpl::char_<4> {};
  174. template <> struct to_upper_char<37> : boost::mpl::char_<5> {};
  175. template <> struct to_upper_char<38> : boost::mpl::char_<6> {};
  176. template <> struct to_upper_char<39> : boost::mpl::char_<7> {};
  177. template <> struct to_upper_char<40> : boost::mpl::char_<8> {};
  178. template <> struct to_upper_char<41> : boost::mpl::char_<9> {};
  179. template <> struct to_upper_char<42> : boost::mpl::char_<10> {};
  180. template <> struct to_upper_char<43> : boost::mpl::char_<11> {};
  181. template <> struct to_upper_char<44> : boost::mpl::char_<12> {};
  182. template <> struct to_upper_char<45> : boost::mpl::char_<13> {};
  183. template <> struct to_upper_char<46> : boost::mpl::char_<14> {};
  184. template <> struct to_upper_char<47> : boost::mpl::char_<15> {};
  185. template <> struct to_upper_char<48> : boost::mpl::char_<16> {};
  186. template <> struct to_upper_char<49> : boost::mpl::char_<17> {};
  187. template <> struct to_upper_char<50> : boost::mpl::char_<18> {};
  188. template <> struct to_upper_char<51> : boost::mpl::char_<19> {};
  189. template <> struct to_upper_char<52> : boost::mpl::char_<20> {};
  190. template <> struct to_upper_char<53> : boost::mpl::char_<21> {};
  191. template <> struct to_upper_char<54> : boost::mpl::char_<22> {};
  192. template <> struct to_upper_char<55> : boost::mpl::char_<23> {};
  193. template <> struct to_upper_char<56> : boost::mpl::char_<24> {};
  194. template <> struct to_upper_char<57> : boost::mpl::char_<25> {};
  195. template <> struct to_upper_char<58> : boost::mpl::char_<26> {};
  196. template <> struct to_upper_char<59> : boost::mpl::char_<27> {};
  197. template <> struct to_upper_char<60> : boost::mpl::char_<28> {};
  198. template <> struct to_upper_char<61> : boost::mpl::char_<29> {};
  199. template <> struct to_upper_char<62> : boost::mpl::char_<30> {};
  200. template <> struct to_upper_char<63> : boost::mpl::char_<31> {};
  201. template <> struct to_upper_char<64> : boost::mpl::char_<32> {};
  202. template <> struct to_upper_char<65> : boost::mpl::char_<33> {};
  203. template <> struct to_upper_char<66> : boost::mpl::char_<34> {};
  204. template <> struct to_upper_char<67> : boost::mpl::char_<35> {};
  205. template <> struct to_upper_char<68> : boost::mpl::char_<36> {};
  206. template <> struct to_upper_char<69> : boost::mpl::char_<37> {};
  207. template <> struct to_upper_char<70> : boost::mpl::char_<38> {};
  208. template <> struct to_upper_char<71> : boost::mpl::char_<39> {};
  209. template <> struct to_upper_char<72> : boost::mpl::char_<40> {};
  210. template <> struct to_upper_char<73> : boost::mpl::char_<41> {};
  211. template <> struct to_upper_char<74> : boost::mpl::char_<42> {};
  212. template <> struct to_upper_char<75> : boost::mpl::char_<43> {};
  213. template <> struct to_upper_char<76> : boost::mpl::char_<44> {};
  214. template <> struct to_upper_char<77> : boost::mpl::char_<45> {};
  215. template <> struct to_upper_char<78> : boost::mpl::char_<46> {};
  216. template <> struct to_upper_char<79> : boost::mpl::char_<47> {};
  217. template <> struct to_upper_char<80> : boost::mpl::char_<48> {};
  218. template <> struct to_upper_char<81> : boost::mpl::char_<49> {};
  219. template <> struct to_upper_char<82> : boost::mpl::char_<50> {};
  220. template <> struct to_upper_char<83> : boost::mpl::char_<51> {};
  221. template <> struct to_upper_char<84> : boost::mpl::char_<52> {};
  222. template <> struct to_upper_char<85> : boost::mpl::char_<53> {};
  223. template <> struct to_upper_char<86> : boost::mpl::char_<54> {};
  224. template <> struct to_upper_char<87> : boost::mpl::char_<55> {};
  225. template <> struct to_upper_char<88> : boost::mpl::char_<56> {};
  226. template <> struct to_upper_char<89> : boost::mpl::char_<57> {};
  227. template <> struct to_upper_char<90> : boost::mpl::char_<58> {};
  228. template <> struct to_upper_char<91> : boost::mpl::char_<59> {};
  229. template <> struct to_upper_char<92> : boost::mpl::char_<60> {};
  230. template <> struct to_upper_char<93> : boost::mpl::char_<61> {};
  231. template <> struct to_upper_char<94> : boost::mpl::char_<62> {};
  232. template <> struct to_upper_char<95> : boost::mpl::char_<63> {};
  233. template <> struct to_upper_char<96> : boost::mpl::char_<64> {};
  234. template <> struct to_upper_char<97> : boost::mpl::char_<65> {};
  235. template <> struct to_upper_char<98> : boost::mpl::char_<66> {};
  236. template <> struct to_upper_char<99> : boost::mpl::char_<67> {};
  237. template <> struct to_upper_char<100> : boost::mpl::char_<68> {};
  238. template <> struct to_upper_char<101> : boost::mpl::char_<69> {};
  239. template <> struct to_upper_char<102> : boost::mpl::char_<70> {};
  240. template <> struct to_upper_char<103> : boost::mpl::char_<71> {};
  241. template <> struct to_upper_char<104> : boost::mpl::char_<72> {};
  242. template <> struct to_upper_char<105> : boost::mpl::char_<73> {};
  243. template <> struct to_upper_char<106> : boost::mpl::char_<74> {};
  244. template <> struct to_upper_char<107> : boost::mpl::char_<75> {};
  245. template <> struct to_upper_char<108> : boost::mpl::char_<76> {};
  246. template <> struct to_upper_char<109> : boost::mpl::char_<77> {};
  247. template <> struct to_upper_char<110> : boost::mpl::char_<78> {};
  248. template <> struct to_upper_char<111> : boost::mpl::char_<79> {};
  249. template <> struct to_upper_char<112> : boost::mpl::char_<80> {};
  250. template <> struct to_upper_char<113> : boost::mpl::char_<81> {};
  251. template <> struct to_upper_char<114> : boost::mpl::char_<82> {};
  252. template <> struct to_upper_char<115> : boost::mpl::char_<83> {};
  253. template <> struct to_upper_char<116> : boost::mpl::char_<84> {};
  254. template <> struct to_upper_char<117> : boost::mpl::char_<85> {};
  255. template <> struct to_upper_char<118> : boost::mpl::char_<86> {};
  256. template <> struct to_upper_char<119> : boost::mpl::char_<87> {};
  257. template <> struct to_upper_char<120> : boost::mpl::char_<88> {};
  258. template <> struct to_upper_char<121> : boost::mpl::char_<89> {};
  259. template <> struct to_upper_char<122> : boost::mpl::char_<90> {};
  260. template <> struct to_upper_char<123> : boost::mpl::char_<91> {};
  261. template <> struct to_upper_char<124> : boost::mpl::char_<92> {};
  262. template <> struct to_upper_char<125> : boost::mpl::char_<93> {};
  263. template <> struct to_upper_char<126> : boost::mpl::char_<94> {};
  264. template <> struct to_upper_char<127> : boost::mpl::char_<95> {};
  265. template <class S>
  266. struct to_upper;
  267. template <char... Cs>
  268. struct to_upper<boost::metaparse::string<Cs...>> :
  269. boost::metaparse::string<to_upper_char<Cs>::value...>
  270. {};
  271. #define CAT_IMPL(a, b) a ## b
  272. #define CAT(a, b) CAT_IMPL(a, b)
  273. #define TEST_STRING(...) to_upper< __VA_ARGS__ >::type CAT(v, __LINE__);