mqt-core 3.3.2__cp314-cp314t-macosx_11_0_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (546) hide show
  1. mqt/core/__init__.py +77 -0
  2. mqt/core/__main__.py +55 -0
  3. mqt/core/_commands.py +52 -0
  4. mqt/core/_compat/__init__.py +11 -0
  5. mqt/core/_compat/typing.py +29 -0
  6. mqt/core/_version.py +34 -0
  7. mqt/core/_version.pyi +12 -0
  8. mqt/core/dd.cpython-314t-darwin.so +0 -0
  9. mqt/core/dd.pyi +1016 -0
  10. mqt/core/dd_evaluation.py +368 -0
  11. mqt/core/fomac.cpython-314t-darwin.so +0 -0
  12. mqt/core/fomac.pyi +125 -0
  13. mqt/core/include/mqt-core/algorithms/BernsteinVazirani.hpp +39 -0
  14. mqt/core/include/mqt-core/algorithms/GHZState.hpp +18 -0
  15. mqt/core/include/mqt-core/algorithms/Grover.hpp +33 -0
  16. mqt/core/include/mqt-core/algorithms/QFT.hpp +21 -0
  17. mqt/core/include/mqt-core/algorithms/QPE.hpp +30 -0
  18. mqt/core/include/mqt-core/algorithms/RandomCliffordCircuit.hpp +22 -0
  19. mqt/core/include/mqt-core/algorithms/StatePreparation.hpp +43 -0
  20. mqt/core/include/mqt-core/algorithms/WState.hpp +18 -0
  21. mqt/core/include/mqt-core/algorithms/mqt_core_algorithms_export.h +43 -0
  22. mqt/core/include/mqt-core/boost/config/abi/borland_prefix.hpp +27 -0
  23. mqt/core/include/mqt-core/boost/config/abi/borland_suffix.hpp +12 -0
  24. mqt/core/include/mqt-core/boost/config/abi/msvc_prefix.hpp +22 -0
  25. mqt/core/include/mqt-core/boost/config/abi/msvc_suffix.hpp +8 -0
  26. mqt/core/include/mqt-core/boost/config/abi_prefix.hpp +25 -0
  27. mqt/core/include/mqt-core/boost/config/abi_suffix.hpp +25 -0
  28. mqt/core/include/mqt-core/boost/config/assert_cxx03.hpp +211 -0
  29. mqt/core/include/mqt-core/boost/config/assert_cxx11.hpp +212 -0
  30. mqt/core/include/mqt-core/boost/config/assert_cxx14.hpp +47 -0
  31. mqt/core/include/mqt-core/boost/config/assert_cxx17.hpp +65 -0
  32. mqt/core/include/mqt-core/boost/config/assert_cxx20.hpp +59 -0
  33. mqt/core/include/mqt-core/boost/config/assert_cxx23.hpp +41 -0
  34. mqt/core/include/mqt-core/boost/config/assert_cxx98.hpp +23 -0
  35. mqt/core/include/mqt-core/boost/config/auto_link.hpp +525 -0
  36. mqt/core/include/mqt-core/boost/config/compiler/borland.hpp +342 -0
  37. mqt/core/include/mqt-core/boost/config/compiler/clang.hpp +370 -0
  38. mqt/core/include/mqt-core/boost/config/compiler/clang_version.hpp +89 -0
  39. mqt/core/include/mqt-core/boost/config/compiler/codegear.hpp +389 -0
  40. mqt/core/include/mqt-core/boost/config/compiler/comeau.hpp +59 -0
  41. mqt/core/include/mqt-core/boost/config/compiler/common_edg.hpp +185 -0
  42. mqt/core/include/mqt-core/boost/config/compiler/compaq_cxx.hpp +19 -0
  43. mqt/core/include/mqt-core/boost/config/compiler/cray.hpp +446 -0
  44. mqt/core/include/mqt-core/boost/config/compiler/diab.hpp +26 -0
  45. mqt/core/include/mqt-core/boost/config/compiler/digitalmars.hpp +146 -0
  46. mqt/core/include/mqt-core/boost/config/compiler/gcc.hpp +386 -0
  47. mqt/core/include/mqt-core/boost/config/compiler/gcc_xml.hpp +115 -0
  48. mqt/core/include/mqt-core/boost/config/compiler/greenhills.hpp +28 -0
  49. mqt/core/include/mqt-core/boost/config/compiler/hp_acc.hpp +153 -0
  50. mqt/core/include/mqt-core/boost/config/compiler/intel.hpp +577 -0
  51. mqt/core/include/mqt-core/boost/config/compiler/kai.hpp +33 -0
  52. mqt/core/include/mqt-core/boost/config/compiler/metrowerks.hpp +201 -0
  53. mqt/core/include/mqt-core/boost/config/compiler/mpw.hpp +143 -0
  54. mqt/core/include/mqt-core/boost/config/compiler/nvcc.hpp +64 -0
  55. mqt/core/include/mqt-core/boost/config/compiler/pathscale.hpp +141 -0
  56. mqt/core/include/mqt-core/boost/config/compiler/pgi.hpp +23 -0
  57. mqt/core/include/mqt-core/boost/config/compiler/sgi_mipspro.hpp +29 -0
  58. mqt/core/include/mqt-core/boost/config/compiler/sunpro_cc.hpp +225 -0
  59. mqt/core/include/mqt-core/boost/config/compiler/vacpp.hpp +189 -0
  60. mqt/core/include/mqt-core/boost/config/compiler/visualc.hpp +398 -0
  61. mqt/core/include/mqt-core/boost/config/compiler/xlcpp.hpp +303 -0
  62. mqt/core/include/mqt-core/boost/config/compiler/xlcpp_zos.hpp +174 -0
  63. mqt/core/include/mqt-core/boost/config/detail/cxx_composite.hpp +218 -0
  64. mqt/core/include/mqt-core/boost/config/detail/posix_features.hpp +95 -0
  65. mqt/core/include/mqt-core/boost/config/detail/select_compiler_config.hpp +157 -0
  66. mqt/core/include/mqt-core/boost/config/detail/select_platform_config.hpp +147 -0
  67. mqt/core/include/mqt-core/boost/config/detail/select_stdlib_config.hpp +121 -0
  68. mqt/core/include/mqt-core/boost/config/detail/suffix.hpp +1334 -0
  69. mqt/core/include/mqt-core/boost/config/header_deprecated.hpp +26 -0
  70. mqt/core/include/mqt-core/boost/config/helper_macros.hpp +37 -0
  71. mqt/core/include/mqt-core/boost/config/no_tr1/cmath.hpp +28 -0
  72. mqt/core/include/mqt-core/boost/config/no_tr1/complex.hpp +28 -0
  73. mqt/core/include/mqt-core/boost/config/no_tr1/functional.hpp +28 -0
  74. mqt/core/include/mqt-core/boost/config/no_tr1/memory.hpp +28 -0
  75. mqt/core/include/mqt-core/boost/config/no_tr1/utility.hpp +28 -0
  76. mqt/core/include/mqt-core/boost/config/platform/aix.hpp +33 -0
  77. mqt/core/include/mqt-core/boost/config/platform/amigaos.hpp +15 -0
  78. mqt/core/include/mqt-core/boost/config/platform/beos.hpp +26 -0
  79. mqt/core/include/mqt-core/boost/config/platform/bsd.hpp +83 -0
  80. mqt/core/include/mqt-core/boost/config/platform/cloudabi.hpp +18 -0
  81. mqt/core/include/mqt-core/boost/config/platform/cray.hpp +18 -0
  82. mqt/core/include/mqt-core/boost/config/platform/cygwin.hpp +71 -0
  83. mqt/core/include/mqt-core/boost/config/platform/haiku.hpp +31 -0
  84. mqt/core/include/mqt-core/boost/config/platform/hpux.hpp +87 -0
  85. mqt/core/include/mqt-core/boost/config/platform/irix.hpp +31 -0
  86. mqt/core/include/mqt-core/boost/config/platform/linux.hpp +106 -0
  87. mqt/core/include/mqt-core/boost/config/platform/macos.hpp +87 -0
  88. mqt/core/include/mqt-core/boost/config/platform/qnxnto.hpp +31 -0
  89. mqt/core/include/mqt-core/boost/config/platform/solaris.hpp +31 -0
  90. mqt/core/include/mqt-core/boost/config/platform/symbian.hpp +97 -0
  91. mqt/core/include/mqt-core/boost/config/platform/vms.hpp +25 -0
  92. mqt/core/include/mqt-core/boost/config/platform/vxworks.hpp +422 -0
  93. mqt/core/include/mqt-core/boost/config/platform/wasm.hpp +23 -0
  94. mqt/core/include/mqt-core/boost/config/platform/win32.hpp +90 -0
  95. mqt/core/include/mqt-core/boost/config/platform/zos.hpp +32 -0
  96. mqt/core/include/mqt-core/boost/config/pragma_message.hpp +31 -0
  97. mqt/core/include/mqt-core/boost/config/requires_threads.hpp +92 -0
  98. mqt/core/include/mqt-core/boost/config/stdlib/dinkumware.hpp +324 -0
  99. mqt/core/include/mqt-core/boost/config/stdlib/libcomo.hpp +93 -0
  100. mqt/core/include/mqt-core/boost/config/stdlib/libcpp.hpp +180 -0
  101. mqt/core/include/mqt-core/boost/config/stdlib/libstdcpp3.hpp +482 -0
  102. mqt/core/include/mqt-core/boost/config/stdlib/modena.hpp +79 -0
  103. mqt/core/include/mqt-core/boost/config/stdlib/msl.hpp +98 -0
  104. mqt/core/include/mqt-core/boost/config/stdlib/roguewave.hpp +208 -0
  105. mqt/core/include/mqt-core/boost/config/stdlib/sgi.hpp +168 -0
  106. mqt/core/include/mqt-core/boost/config/stdlib/stlport.hpp +258 -0
  107. mqt/core/include/mqt-core/boost/config/stdlib/vacpp.hpp +74 -0
  108. mqt/core/include/mqt-core/boost/config/stdlib/xlcpp_zos.hpp +61 -0
  109. mqt/core/include/mqt-core/boost/config/user.hpp +133 -0
  110. mqt/core/include/mqt-core/boost/config/warning_disable.hpp +47 -0
  111. mqt/core/include/mqt-core/boost/config/workaround.hpp +305 -0
  112. mqt/core/include/mqt-core/boost/config.hpp +67 -0
  113. mqt/core/include/mqt-core/boost/cstdint.hpp +556 -0
  114. mqt/core/include/mqt-core/boost/cxx11_char_types.hpp +70 -0
  115. mqt/core/include/mqt-core/boost/detail/workaround.hpp +10 -0
  116. mqt/core/include/mqt-core/boost/limits.hpp +146 -0
  117. mqt/core/include/mqt-core/boost/multiprecision/complex128.hpp +24 -0
  118. mqt/core/include/mqt-core/boost/multiprecision/complex_adaptor.hpp +1046 -0
  119. mqt/core/include/mqt-core/boost/multiprecision/concepts/mp_number_archetypes.hpp +257 -0
  120. mqt/core/include/mqt-core/boost/multiprecision/cpp_bin_float/io.hpp +698 -0
  121. mqt/core/include/mqt-core/boost/multiprecision/cpp_bin_float/transcendental.hpp +157 -0
  122. mqt/core/include/mqt-core/boost/multiprecision/cpp_bin_float.hpp +2297 -0
  123. mqt/core/include/mqt-core/boost/multiprecision/cpp_complex.hpp +12 -0
  124. mqt/core/include/mqt-core/boost/multiprecision/cpp_dec_float.hpp +3690 -0
  125. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/add.hpp +368 -0
  126. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/add_unsigned.hpp +387 -0
  127. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/bitwise.hpp +889 -0
  128. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/checked.hpp +178 -0
  129. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/comparison.hpp +374 -0
  130. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/cpp_int_config.hpp +161 -0
  131. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/divide.hpp +703 -0
  132. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/import_export.hpp +248 -0
  133. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/intel_intrinsics.hpp +138 -0
  134. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/limits.hpp +282 -0
  135. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/literals.hpp +295 -0
  136. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/misc.hpp +1457 -0
  137. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/multiply.hpp +848 -0
  138. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/serialize.hpp +211 -0
  139. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/value_pack.hpp +42 -0
  140. mqt/core/include/mqt-core/boost/multiprecision/cpp_int.hpp +2360 -0
  141. mqt/core/include/mqt-core/boost/multiprecision/debug_adaptor.hpp +760 -0
  142. mqt/core/include/mqt-core/boost/multiprecision/detail/assert.hpp +29 -0
  143. mqt/core/include/mqt-core/boost/multiprecision/detail/atomic.hpp +62 -0
  144. mqt/core/include/mqt-core/boost/multiprecision/detail/bitscan.hpp +317 -0
  145. mqt/core/include/mqt-core/boost/multiprecision/detail/check_cpp11_config.hpp +64 -0
  146. mqt/core/include/mqt-core/boost/multiprecision/detail/constexpr.hpp +88 -0
  147. mqt/core/include/mqt-core/boost/multiprecision/detail/default_ops.hpp +4052 -0
  148. mqt/core/include/mqt-core/boost/multiprecision/detail/digits.hpp +49 -0
  149. mqt/core/include/mqt-core/boost/multiprecision/detail/dynamic_array.hpp +44 -0
  150. mqt/core/include/mqt-core/boost/multiprecision/detail/empty_value.hpp +87 -0
  151. mqt/core/include/mqt-core/boost/multiprecision/detail/endian.hpp +35 -0
  152. mqt/core/include/mqt-core/boost/multiprecision/detail/et_ops.hpp +1831 -0
  153. mqt/core/include/mqt-core/boost/multiprecision/detail/float128_functions.hpp +95 -0
  154. mqt/core/include/mqt-core/boost/multiprecision/detail/float_string_cvt.hpp +333 -0
  155. mqt/core/include/mqt-core/boost/multiprecision/detail/fpclassify.hpp +101 -0
  156. mqt/core/include/mqt-core/boost/multiprecision/detail/functions/constants.hpp +288 -0
  157. mqt/core/include/mqt-core/boost/multiprecision/detail/functions/pow.hpp +905 -0
  158. mqt/core/include/mqt-core/boost/multiprecision/detail/functions/trig.hpp +1058 -0
  159. mqt/core/include/mqt-core/boost/multiprecision/detail/functions/trunc.hpp +82 -0
  160. mqt/core/include/mqt-core/boost/multiprecision/detail/generic_interconvert.hpp +687 -0
  161. mqt/core/include/mqt-core/boost/multiprecision/detail/hash.hpp +56 -0
  162. mqt/core/include/mqt-core/boost/multiprecision/detail/integer_ops.hpp +474 -0
  163. mqt/core/include/mqt-core/boost/multiprecision/detail/itos.hpp +39 -0
  164. mqt/core/include/mqt-core/boost/multiprecision/detail/min_max.hpp +106 -0
  165. mqt/core/include/mqt-core/boost/multiprecision/detail/no_et_ops.hpp +661 -0
  166. mqt/core/include/mqt-core/boost/multiprecision/detail/no_exceptions_support.hpp +55 -0
  167. mqt/core/include/mqt-core/boost/multiprecision/detail/number_base.hpp +1656 -0
  168. mqt/core/include/mqt-core/boost/multiprecision/detail/number_compare.hpp +848 -0
  169. mqt/core/include/mqt-core/boost/multiprecision/detail/precision.hpp +313 -0
  170. mqt/core/include/mqt-core/boost/multiprecision/detail/rebind.hpp +19 -0
  171. mqt/core/include/mqt-core/boost/multiprecision/detail/standalone_config.hpp +148 -0
  172. mqt/core/include/mqt-core/boost/multiprecision/detail/static_array.hpp +42 -0
  173. mqt/core/include/mqt-core/boost/multiprecision/detail/string_helpers.hpp +48 -0
  174. mqt/core/include/mqt-core/boost/multiprecision/detail/tables.hpp +80 -0
  175. mqt/core/include/mqt-core/boost/multiprecision/detail/ublas_interop.hpp +75 -0
  176. mqt/core/include/mqt-core/boost/multiprecision/detail/uniform_int_distribution.hpp +212 -0
  177. mqt/core/include/mqt-core/boost/multiprecision/detail/utype_helper.hpp +374 -0
  178. mqt/core/include/mqt-core/boost/multiprecision/eigen.hpp +248 -0
  179. mqt/core/include/mqt-core/boost/multiprecision/float128.hpp +920 -0
  180. mqt/core/include/mqt-core/boost/multiprecision/fwd.hpp +268 -0
  181. mqt/core/include/mqt-core/boost/multiprecision/gmp.hpp +4060 -0
  182. mqt/core/include/mqt-core/boost/multiprecision/integer.hpp +363 -0
  183. mqt/core/include/mqt-core/boost/multiprecision/logged_adaptor.hpp +834 -0
  184. mqt/core/include/mqt-core/boost/multiprecision/miller_rabin.hpp +221 -0
  185. mqt/core/include/mqt-core/boost/multiprecision/mpc.hpp +1721 -0
  186. mqt/core/include/mqt-core/boost/multiprecision/mpfi.hpp +2559 -0
  187. mqt/core/include/mqt-core/boost/multiprecision/mpfr.hpp +3644 -0
  188. mqt/core/include/mqt-core/boost/multiprecision/number.hpp +2500 -0
  189. mqt/core/include/mqt-core/boost/multiprecision/random.hpp +23 -0
  190. mqt/core/include/mqt-core/boost/multiprecision/rational_adaptor.hpp +1289 -0
  191. mqt/core/include/mqt-core/boost/multiprecision/tommath.hpp +1034 -0
  192. mqt/core/include/mqt-core/boost/multiprecision/traits/explicit_conversion.hpp +67 -0
  193. mqt/core/include/mqt-core/boost/multiprecision/traits/extract_exponent_type.hpp +28 -0
  194. mqt/core/include/mqt-core/boost/multiprecision/traits/is_backend.hpp +91 -0
  195. mqt/core/include/mqt-core/boost/multiprecision/traits/is_byte_container.hpp +51 -0
  196. mqt/core/include/mqt-core/boost/multiprecision/traits/is_complex.hpp +22 -0
  197. mqt/core/include/mqt-core/boost/multiprecision/traits/is_convertible_arithmetic.hpp +51 -0
  198. mqt/core/include/mqt-core/boost/multiprecision/traits/is_restricted_conversion.hpp +47 -0
  199. mqt/core/include/mqt-core/boost/multiprecision/traits/is_variable_precision.hpp +25 -0
  200. mqt/core/include/mqt-core/boost/multiprecision/traits/max_digits10.hpp +79 -0
  201. mqt/core/include/mqt-core/boost/multiprecision/traits/std_integer_traits.hpp +90 -0
  202. mqt/core/include/mqt-core/boost/multiprecision/traits/transcendental_reduction_type.hpp +21 -0
  203. mqt/core/include/mqt-core/boost/version.hpp +32 -0
  204. mqt/core/include/mqt-core/circuit_optimizer/CircuitOptimizer.hpp +119 -0
  205. mqt/core/include/mqt-core/circuit_optimizer/mqt_core_circuit_optimizer_export.h +43 -0
  206. mqt/core/include/mqt-core/datastructures/DirectedAcyclicGraph.hpp +117 -0
  207. mqt/core/include/mqt-core/datastructures/DirectedGraph.hpp +158 -0
  208. mqt/core/include/mqt-core/datastructures/DisjointSet.hpp +50 -0
  209. mqt/core/include/mqt-core/datastructures/Layer.hpp +172 -0
  210. mqt/core/include/mqt-core/datastructures/SymmetricMatrix.hpp +57 -0
  211. mqt/core/include/mqt-core/datastructures/UndirectedGraph.hpp +227 -0
  212. mqt/core/include/mqt-core/datastructures/mqt_core_ds_export.h +43 -0
  213. mqt/core/include/mqt-core/dd/Approximation.hpp +45 -0
  214. mqt/core/include/mqt-core/dd/CachedEdge.hpp +174 -0
  215. mqt/core/include/mqt-core/dd/Complex.hpp +165 -0
  216. mqt/core/include/mqt-core/dd/ComplexNumbers.hpp +150 -0
  217. mqt/core/include/mqt-core/dd/ComplexValue.hpp +184 -0
  218. mqt/core/include/mqt-core/dd/ComputeTable.hpp +183 -0
  219. mqt/core/include/mqt-core/dd/DDDefinitions.hpp +139 -0
  220. mqt/core/include/mqt-core/dd/DDpackageConfig.hpp +104 -0
  221. mqt/core/include/mqt-core/dd/DensityNoiseTable.hpp +114 -0
  222. mqt/core/include/mqt-core/dd/Edge.hpp +416 -0
  223. mqt/core/include/mqt-core/dd/Export.hpp +438 -0
  224. mqt/core/include/mqt-core/dd/FunctionalityConstruction.hpp +75 -0
  225. mqt/core/include/mqt-core/dd/GateMatrixDefinitions.hpp +43 -0
  226. mqt/core/include/mqt-core/dd/LinkedListBase.hpp +45 -0
  227. mqt/core/include/mqt-core/dd/MemoryManager.hpp +193 -0
  228. mqt/core/include/mqt-core/dd/Node.hpp +223 -0
  229. mqt/core/include/mqt-core/dd/NoiseFunctionality.hpp +144 -0
  230. mqt/core/include/mqt-core/dd/Operations.hpp +306 -0
  231. mqt/core/include/mqt-core/dd/Package.hpp +2036 -0
  232. mqt/core/include/mqt-core/dd/Package_fwd.hpp +22 -0
  233. mqt/core/include/mqt-core/dd/RealNumber.hpp +255 -0
  234. mqt/core/include/mqt-core/dd/RealNumberUniqueTable.hpp +217 -0
  235. mqt/core/include/mqt-core/dd/Simulation.hpp +98 -0
  236. mqt/core/include/mqt-core/dd/StateGeneration.hpp +143 -0
  237. mqt/core/include/mqt-core/dd/StochasticNoiseOperationTable.hpp +88 -0
  238. mqt/core/include/mqt-core/dd/UnaryComputeTable.hpp +121 -0
  239. mqt/core/include/mqt-core/dd/UniqueTable.hpp +243 -0
  240. mqt/core/include/mqt-core/dd/mqt_core_dd_export.h +43 -0
  241. mqt/core/include/mqt-core/dd/statistics/MemoryManagerStatistics.hpp +84 -0
  242. mqt/core/include/mqt-core/dd/statistics/PackageStatistics.hpp +55 -0
  243. mqt/core/include/mqt-core/dd/statistics/Statistics.hpp +48 -0
  244. mqt/core/include/mqt-core/dd/statistics/TableStatistics.hpp +79 -0
  245. mqt/core/include/mqt-core/dd/statistics/UniqueTableStatistics.hpp +31 -0
  246. mqt/core/include/mqt-core/fomac/FoMaC.hpp +568 -0
  247. mqt/core/include/mqt-core/ir/Definitions.hpp +108 -0
  248. mqt/core/include/mqt-core/ir/Permutation.hpp +213 -0
  249. mqt/core/include/mqt-core/ir/QuantumComputation.hpp +596 -0
  250. mqt/core/include/mqt-core/ir/Register.hpp +125 -0
  251. mqt/core/include/mqt-core/ir/mqt_core_ir_export.h +43 -0
  252. mqt/core/include/mqt-core/ir/operations/AodOperation.hpp +92 -0
  253. mqt/core/include/mqt-core/ir/operations/CompoundOperation.hpp +212 -0
  254. mqt/core/include/mqt-core/ir/operations/Control.hpp +142 -0
  255. mqt/core/include/mqt-core/ir/operations/Expression.hpp +847 -0
  256. mqt/core/include/mqt-core/ir/operations/IfElseOperation.hpp +169 -0
  257. mqt/core/include/mqt-core/ir/operations/NonUnitaryOperation.hpp +118 -0
  258. mqt/core/include/mqt-core/ir/operations/OpType.hpp +120 -0
  259. mqt/core/include/mqt-core/ir/operations/OpType.inc +76 -0
  260. mqt/core/include/mqt-core/ir/operations/Operation.hpp +247 -0
  261. mqt/core/include/mqt-core/ir/operations/StandardOperation.hpp +140 -0
  262. mqt/core/include/mqt-core/ir/operations/SymbolicOperation.hpp +144 -0
  263. mqt/core/include/mqt-core/mqt_na_qdmi/device.h +602 -0
  264. mqt/core/include/mqt-core/mqt_na_qdmi/types.h +78 -0
  265. mqt/core/include/mqt-core/na/NAComputation.hpp +185 -0
  266. mqt/core/include/mqt-core/na/device/Device.hpp +410 -0
  267. mqt/core/include/mqt-core/na/device/DeviceMemberInitializers.hpp +724 -0
  268. mqt/core/include/mqt-core/na/device/Generator.hpp +447 -0
  269. mqt/core/include/mqt-core/na/entities/Atom.hpp +62 -0
  270. mqt/core/include/mqt-core/na/entities/Location.hpp +154 -0
  271. mqt/core/include/mqt-core/na/entities/Zone.hpp +95 -0
  272. mqt/core/include/mqt-core/na/fomac/Device.hpp +169 -0
  273. mqt/core/include/mqt-core/na/mqt_core_na_export.h +43 -0
  274. mqt/core/include/mqt-core/na/operations/GlobalCZOp.hpp +38 -0
  275. mqt/core/include/mqt-core/na/operations/GlobalOp.hpp +58 -0
  276. mqt/core/include/mqt-core/na/operations/GlobalRYOp.hpp +42 -0
  277. mqt/core/include/mqt-core/na/operations/LoadOp.hpp +89 -0
  278. mqt/core/include/mqt-core/na/operations/LocalOp.hpp +56 -0
  279. mqt/core/include/mqt-core/na/operations/LocalRZOp.hpp +42 -0
  280. mqt/core/include/mqt-core/na/operations/LocalUOp.hpp +49 -0
  281. mqt/core/include/mqt-core/na/operations/MoveOp.hpp +66 -0
  282. mqt/core/include/mqt-core/na/operations/Op.hpp +62 -0
  283. mqt/core/include/mqt-core/na/operations/ShuttlingOp.hpp +51 -0
  284. mqt/core/include/mqt-core/na/operations/StoreOp.hpp +87 -0
  285. mqt/core/include/mqt-core/qasm3/Exception.hpp +85 -0
  286. mqt/core/include/mqt-core/qasm3/Gate.hpp +65 -0
  287. mqt/core/include/mqt-core/qasm3/Importer.hpp +192 -0
  288. mqt/core/include/mqt-core/qasm3/InstVisitor.hpp +145 -0
  289. mqt/core/include/mqt-core/qasm3/NestedEnvironment.hpp +41 -0
  290. mqt/core/include/mqt-core/qasm3/Parser.hpp +170 -0
  291. mqt/core/include/mqt-core/qasm3/Scanner.hpp +73 -0
  292. mqt/core/include/mqt-core/qasm3/Statement.hpp +486 -0
  293. mqt/core/include/mqt-core/qasm3/Statement_fwd.hpp +39 -0
  294. mqt/core/include/mqt-core/qasm3/StdGates.hpp +232 -0
  295. mqt/core/include/mqt-core/qasm3/Token.hpp +198 -0
  296. mqt/core/include/mqt-core/qasm3/Types.hpp +238 -0
  297. mqt/core/include/mqt-core/qasm3/Types_fwd.hpp +22 -0
  298. mqt/core/include/mqt-core/qasm3/mqt_core_qasm_export.h +43 -0
  299. mqt/core/include/mqt-core/qasm3/passes/CompilerPass.hpp +22 -0
  300. mqt/core/include/mqt-core/qasm3/passes/ConstEvalPass.hpp +102 -0
  301. mqt/core/include/mqt-core/qasm3/passes/TypeCheckPass.hpp +124 -0
  302. mqt/core/include/mqt-core/qdmi/Driver.hpp +431 -0
  303. mqt/core/include/mqt-core/zx/FunctionalityConstruction.hpp +125 -0
  304. mqt/core/include/mqt-core/zx/Rational.hpp +318 -0
  305. mqt/core/include/mqt-core/zx/Rules.hpp +132 -0
  306. mqt/core/include/mqt-core/zx/Simplify.hpp +182 -0
  307. mqt/core/include/mqt-core/zx/Utils.hpp +212 -0
  308. mqt/core/include/mqt-core/zx/ZXDefinitions.hpp +93 -0
  309. mqt/core/include/mqt-core/zx/ZXDiagram.hpp +480 -0
  310. mqt/core/include/mqt-core/zx/mqt_core_zx_export.h +43 -0
  311. mqt/core/include/nlohmann/adl_serializer.hpp +55 -0
  312. mqt/core/include/nlohmann/byte_container_with_subtype.hpp +103 -0
  313. mqt/core/include/nlohmann/detail/abi_macros.hpp +111 -0
  314. mqt/core/include/nlohmann/detail/conversions/from_json.hpp +577 -0
  315. mqt/core/include/nlohmann/detail/conversions/to_chars.hpp +1118 -0
  316. mqt/core/include/nlohmann/detail/conversions/to_json.hpp +479 -0
  317. mqt/core/include/nlohmann/detail/exceptions.hpp +291 -0
  318. mqt/core/include/nlohmann/detail/hash.hpp +129 -0
  319. mqt/core/include/nlohmann/detail/input/binary_reader.hpp +3068 -0
  320. mqt/core/include/nlohmann/detail/input/input_adapters.hpp +549 -0
  321. mqt/core/include/nlohmann/detail/input/json_sax.hpp +986 -0
  322. mqt/core/include/nlohmann/detail/input/lexer.hpp +1643 -0
  323. mqt/core/include/nlohmann/detail/input/parser.hpp +519 -0
  324. mqt/core/include/nlohmann/detail/input/position_t.hpp +37 -0
  325. mqt/core/include/nlohmann/detail/iterators/internal_iterator.hpp +35 -0
  326. mqt/core/include/nlohmann/detail/iterators/iter_impl.hpp +760 -0
  327. mqt/core/include/nlohmann/detail/iterators/iteration_proxy.hpp +235 -0
  328. mqt/core/include/nlohmann/detail/iterators/iterator_traits.hpp +61 -0
  329. mqt/core/include/nlohmann/detail/iterators/json_reverse_iterator.hpp +130 -0
  330. mqt/core/include/nlohmann/detail/iterators/primitive_iterator.hpp +132 -0
  331. mqt/core/include/nlohmann/detail/json_custom_base_class.hpp +39 -0
  332. mqt/core/include/nlohmann/detail/json_pointer.hpp +988 -0
  333. mqt/core/include/nlohmann/detail/json_ref.hpp +78 -0
  334. mqt/core/include/nlohmann/detail/macro_scope.hpp +595 -0
  335. mqt/core/include/nlohmann/detail/macro_unscope.hpp +46 -0
  336. mqt/core/include/nlohmann/detail/meta/call_std/begin.hpp +17 -0
  337. mqt/core/include/nlohmann/detail/meta/call_std/end.hpp +17 -0
  338. mqt/core/include/nlohmann/detail/meta/cpp_future.hpp +171 -0
  339. mqt/core/include/nlohmann/detail/meta/detected.hpp +70 -0
  340. mqt/core/include/nlohmann/detail/meta/identity_tag.hpp +21 -0
  341. mqt/core/include/nlohmann/detail/meta/is_sax.hpp +159 -0
  342. mqt/core/include/nlohmann/detail/meta/std_fs.hpp +29 -0
  343. mqt/core/include/nlohmann/detail/meta/type_traits.hpp +795 -0
  344. mqt/core/include/nlohmann/detail/meta/void_t.hpp +24 -0
  345. mqt/core/include/nlohmann/detail/output/binary_writer.hpp +1850 -0
  346. mqt/core/include/nlohmann/detail/output/output_adapters.hpp +147 -0
  347. mqt/core/include/nlohmann/detail/output/serializer.hpp +988 -0
  348. mqt/core/include/nlohmann/detail/string_concat.hpp +146 -0
  349. mqt/core/include/nlohmann/detail/string_escape.hpp +72 -0
  350. mqt/core/include/nlohmann/detail/string_utils.hpp +37 -0
  351. mqt/core/include/nlohmann/detail/value_t.hpp +118 -0
  352. mqt/core/include/nlohmann/json.hpp +5306 -0
  353. mqt/core/include/nlohmann/json_fwd.hpp +75 -0
  354. mqt/core/include/nlohmann/ordered_map.hpp +359 -0
  355. mqt/core/include/nlohmann/thirdparty/hedley/hedley.hpp +2045 -0
  356. mqt/core/include/nlohmann/thirdparty/hedley/hedley_undef.hpp +158 -0
  357. mqt/core/include/qdmi/qdmi/client.h +990 -0
  358. mqt/core/include/qdmi/qdmi/constants.h +1139 -0
  359. mqt/core/include/qdmi/qdmi/device.h +602 -0
  360. mqt/core/include/qdmi/qdmi/types.h +78 -0
  361. mqt/core/include/spdlog/async.h +99 -0
  362. mqt/core/include/spdlog/async_logger-inl.h +84 -0
  363. mqt/core/include/spdlog/async_logger.h +74 -0
  364. mqt/core/include/spdlog/cfg/argv.h +40 -0
  365. mqt/core/include/spdlog/cfg/env.h +36 -0
  366. mqt/core/include/spdlog/cfg/helpers-inl.h +107 -0
  367. mqt/core/include/spdlog/cfg/helpers.h +29 -0
  368. mqt/core/include/spdlog/common-inl.h +68 -0
  369. mqt/core/include/spdlog/common.h +406 -0
  370. mqt/core/include/spdlog/details/backtracer-inl.h +63 -0
  371. mqt/core/include/spdlog/details/backtracer.h +45 -0
  372. mqt/core/include/spdlog/details/circular_q.h +115 -0
  373. mqt/core/include/spdlog/details/console_globals.h +28 -0
  374. mqt/core/include/spdlog/details/file_helper-inl.h +153 -0
  375. mqt/core/include/spdlog/details/file_helper.h +61 -0
  376. mqt/core/include/spdlog/details/fmt_helper.h +141 -0
  377. mqt/core/include/spdlog/details/log_msg-inl.h +44 -0
  378. mqt/core/include/spdlog/details/log_msg.h +40 -0
  379. mqt/core/include/spdlog/details/log_msg_buffer-inl.h +54 -0
  380. mqt/core/include/spdlog/details/log_msg_buffer.h +32 -0
  381. mqt/core/include/spdlog/details/mpmc_blocking_q.h +177 -0
  382. mqt/core/include/spdlog/details/null_mutex.h +35 -0
  383. mqt/core/include/spdlog/details/os-inl.h +606 -0
  384. mqt/core/include/spdlog/details/os.h +127 -0
  385. mqt/core/include/spdlog/details/periodic_worker-inl.h +26 -0
  386. mqt/core/include/spdlog/details/periodic_worker.h +58 -0
  387. mqt/core/include/spdlog/details/registry-inl.h +270 -0
  388. mqt/core/include/spdlog/details/registry.h +131 -0
  389. mqt/core/include/spdlog/details/synchronous_factory.h +22 -0
  390. mqt/core/include/spdlog/details/tcp_client-windows.h +135 -0
  391. mqt/core/include/spdlog/details/tcp_client.h +127 -0
  392. mqt/core/include/spdlog/details/thread_pool-inl.h +126 -0
  393. mqt/core/include/spdlog/details/thread_pool.h +117 -0
  394. mqt/core/include/spdlog/details/udp_client-windows.h +98 -0
  395. mqt/core/include/spdlog/details/udp_client.h +81 -0
  396. mqt/core/include/spdlog/details/windows_include.h +11 -0
  397. mqt/core/include/spdlog/fmt/bin_to_hex.h +224 -0
  398. mqt/core/include/spdlog/fmt/bundled/args.h +220 -0
  399. mqt/core/include/spdlog/fmt/bundled/base.h +2989 -0
  400. mqt/core/include/spdlog/fmt/bundled/chrono.h +2330 -0
  401. mqt/core/include/spdlog/fmt/bundled/color.h +637 -0
  402. mqt/core/include/spdlog/fmt/bundled/compile.h +539 -0
  403. mqt/core/include/spdlog/fmt/bundled/core.h +5 -0
  404. mqt/core/include/spdlog/fmt/bundled/fmt.license.rst +27 -0
  405. mqt/core/include/spdlog/fmt/bundled/format-inl.h +1948 -0
  406. mqt/core/include/spdlog/fmt/bundled/format.h +4244 -0
  407. mqt/core/include/spdlog/fmt/bundled/os.h +427 -0
  408. mqt/core/include/spdlog/fmt/bundled/ostream.h +167 -0
  409. mqt/core/include/spdlog/fmt/bundled/printf.h +633 -0
  410. mqt/core/include/spdlog/fmt/bundled/ranges.h +850 -0
  411. mqt/core/include/spdlog/fmt/bundled/std.h +728 -0
  412. mqt/core/include/spdlog/fmt/bundled/xchar.h +369 -0
  413. mqt/core/include/spdlog/fmt/chrono.h +23 -0
  414. mqt/core/include/spdlog/fmt/compile.h +23 -0
  415. mqt/core/include/spdlog/fmt/fmt.h +30 -0
  416. mqt/core/include/spdlog/fmt/ostr.h +23 -0
  417. mqt/core/include/spdlog/fmt/ranges.h +23 -0
  418. mqt/core/include/spdlog/fmt/std.h +24 -0
  419. mqt/core/include/spdlog/fmt/xchar.h +23 -0
  420. mqt/core/include/spdlog/formatter.h +17 -0
  421. mqt/core/include/spdlog/fwd.h +18 -0
  422. mqt/core/include/spdlog/logger-inl.h +198 -0
  423. mqt/core/include/spdlog/logger.h +379 -0
  424. mqt/core/include/spdlog/mdc.h +52 -0
  425. mqt/core/include/spdlog/pattern_formatter-inl.h +1340 -0
  426. mqt/core/include/spdlog/pattern_formatter.h +118 -0
  427. mqt/core/include/spdlog/sinks/android_sink.h +137 -0
  428. mqt/core/include/spdlog/sinks/ansicolor_sink-inl.h +142 -0
  429. mqt/core/include/spdlog/sinks/ansicolor_sink.h +116 -0
  430. mqt/core/include/spdlog/sinks/base_sink-inl.h +59 -0
  431. mqt/core/include/spdlog/sinks/base_sink.h +51 -0
  432. mqt/core/include/spdlog/sinks/basic_file_sink-inl.h +48 -0
  433. mqt/core/include/spdlog/sinks/basic_file_sink.h +66 -0
  434. mqt/core/include/spdlog/sinks/callback_sink.h +56 -0
  435. mqt/core/include/spdlog/sinks/daily_file_sink.h +254 -0
  436. mqt/core/include/spdlog/sinks/dist_sink.h +81 -0
  437. mqt/core/include/spdlog/sinks/dup_filter_sink.h +91 -0
  438. mqt/core/include/spdlog/sinks/hourly_file_sink.h +193 -0
  439. mqt/core/include/spdlog/sinks/kafka_sink.h +119 -0
  440. mqt/core/include/spdlog/sinks/mongo_sink.h +108 -0
  441. mqt/core/include/spdlog/sinks/msvc_sink.h +68 -0
  442. mqt/core/include/spdlog/sinks/null_sink.h +41 -0
  443. mqt/core/include/spdlog/sinks/ostream_sink.h +43 -0
  444. mqt/core/include/spdlog/sinks/qt_sinks.h +304 -0
  445. mqt/core/include/spdlog/sinks/ringbuffer_sink.h +67 -0
  446. mqt/core/include/spdlog/sinks/rotating_file_sink-inl.h +179 -0
  447. mqt/core/include/spdlog/sinks/rotating_file_sink.h +93 -0
  448. mqt/core/include/spdlog/sinks/sink-inl.h +22 -0
  449. mqt/core/include/spdlog/sinks/sink.h +34 -0
  450. mqt/core/include/spdlog/sinks/stdout_color_sinks-inl.h +38 -0
  451. mqt/core/include/spdlog/sinks/stdout_color_sinks.h +49 -0
  452. mqt/core/include/spdlog/sinks/stdout_sinks-inl.h +127 -0
  453. mqt/core/include/spdlog/sinks/stdout_sinks.h +84 -0
  454. mqt/core/include/spdlog/sinks/syslog_sink.h +104 -0
  455. mqt/core/include/spdlog/sinks/systemd_sink.h +121 -0
  456. mqt/core/include/spdlog/sinks/tcp_sink.h +75 -0
  457. mqt/core/include/spdlog/sinks/udp_sink.h +69 -0
  458. mqt/core/include/spdlog/sinks/win_eventlog_sink.h +260 -0
  459. mqt/core/include/spdlog/sinks/wincolor_sink-inl.h +172 -0
  460. mqt/core/include/spdlog/sinks/wincolor_sink.h +82 -0
  461. mqt/core/include/spdlog/spdlog-inl.h +96 -0
  462. mqt/core/include/spdlog/spdlog.h +357 -0
  463. mqt/core/include/spdlog/stopwatch.h +66 -0
  464. mqt/core/include/spdlog/tweakme.h +148 -0
  465. mqt/core/include/spdlog/version.h +11 -0
  466. mqt/core/ir/__init__.pyi +2078 -0
  467. mqt/core/ir/operations.pyi +1011 -0
  468. mqt/core/ir/registers.pyi +91 -0
  469. mqt/core/ir/symbolic.pyi +177 -0
  470. mqt/core/ir.cpython-314t-darwin.so +0 -0
  471. mqt/core/lib/libmqt-core-algorithms.3.3.2.dylib +0 -0
  472. mqt/core/lib/libmqt-core-algorithms.3.3.dylib +0 -0
  473. mqt/core/lib/libmqt-core-algorithms.dylib +0 -0
  474. mqt/core/lib/libmqt-core-circuit-optimizer.3.3.2.dylib +0 -0
  475. mqt/core/lib/libmqt-core-circuit-optimizer.3.3.dylib +0 -0
  476. mqt/core/lib/libmqt-core-circuit-optimizer.dylib +0 -0
  477. mqt/core/lib/libmqt-core-dd.3.3.2.dylib +0 -0
  478. mqt/core/lib/libmqt-core-dd.3.3.dylib +0 -0
  479. mqt/core/lib/libmqt-core-dd.dylib +0 -0
  480. mqt/core/lib/libmqt-core-ds.3.3.2.dylib +0 -0
  481. mqt/core/lib/libmqt-core-ds.3.3.dylib +0 -0
  482. mqt/core/lib/libmqt-core-ds.dylib +0 -0
  483. mqt/core/lib/libmqt-core-fomac.3.3.2.dylib +0 -0
  484. mqt/core/lib/libmqt-core-fomac.3.3.dylib +0 -0
  485. mqt/core/lib/libmqt-core-fomac.dylib +0 -0
  486. mqt/core/lib/libmqt-core-ir.3.3.2.dylib +0 -0
  487. mqt/core/lib/libmqt-core-ir.3.3.dylib +0 -0
  488. mqt/core/lib/libmqt-core-ir.dylib +0 -0
  489. mqt/core/lib/libmqt-core-na-fomac.3.3.2.dylib +0 -0
  490. mqt/core/lib/libmqt-core-na-fomac.3.3.dylib +0 -0
  491. mqt/core/lib/libmqt-core-na-fomac.dylib +0 -0
  492. mqt/core/lib/libmqt-core-na.3.3.2.dylib +0 -0
  493. mqt/core/lib/libmqt-core-na.3.3.dylib +0 -0
  494. mqt/core/lib/libmqt-core-na.dylib +0 -0
  495. mqt/core/lib/libmqt-core-qasm.3.3.2.dylib +0 -0
  496. mqt/core/lib/libmqt-core-qasm.3.3.dylib +0 -0
  497. mqt/core/lib/libmqt-core-qasm.dylib +0 -0
  498. mqt/core/lib/libmqt-core-qdmi-driver.3.3.2.dylib +0 -0
  499. mqt/core/lib/libmqt-core-qdmi-driver.3.3.dylib +0 -0
  500. mqt/core/lib/libmqt-core-qdmi-driver.dylib +0 -0
  501. mqt/core/lib/libmqt-core-qdmi-na-device-gen.a +0 -0
  502. mqt/core/lib/libmqt-core-qdmi-na-device.3.3.2.dylib +0 -0
  503. mqt/core/lib/libmqt-core-qdmi-na-device.3.3.dylib +0 -0
  504. mqt/core/lib/libmqt-core-qdmi-na-device.dylib +0 -0
  505. mqt/core/lib/libmqt-core-zx.3.3.2.dylib +0 -0
  506. mqt/core/lib/libmqt-core-zx.3.3.dylib +0 -0
  507. mqt/core/lib/libmqt-core-zx.dylib +0 -0
  508. mqt/core/lib/libspdlog.a +0 -0
  509. mqt/core/lib/pkgconfig/spdlog.pc +13 -0
  510. mqt/core/na/__init__.py +12 -0
  511. mqt/core/na/fomac.cpython-314t-darwin.so +0 -0
  512. mqt/core/na/fomac.pyi +117 -0
  513. mqt/core/plugins/__init__.py +9 -0
  514. mqt/core/plugins/qiskit/__init__.py +19 -0
  515. mqt/core/plugins/qiskit/mqt_to_qiskit.py +420 -0
  516. mqt/core/plugins/qiskit/qiskit_to_mqt.py +562 -0
  517. mqt/core/py.typed +2 -0
  518. mqt/core/share/cmake/mqt-core/AddMQTPythonBinding.cmake +55 -0
  519. mqt/core/share/cmake/mqt-core/Cache.cmake +33 -0
  520. mqt/core/share/cmake/mqt-core/FindGMP.cmake +103 -0
  521. mqt/core/share/cmake/mqt-core/PackageAddTest.cmake +46 -0
  522. mqt/core/share/cmake/mqt-core/PreventInSourceBuilds.cmake +25 -0
  523. mqt/core/share/cmake/mqt-core/StandardProjectSettings.cmake +87 -0
  524. mqt/core/share/cmake/mqt-core/mqt-core-config-version.cmake +85 -0
  525. mqt/core/share/cmake/mqt-core/mqt-core-config.cmake +52 -0
  526. mqt/core/share/cmake/mqt-core/mqt-core-targets-release.cmake +141 -0
  527. mqt/core/share/cmake/mqt-core/mqt-core-targets.cmake +446 -0
  528. mqt/core/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake +15 -0
  529. mqt/core/share/cmake/nlohmann_json/nlohmann_jsonConfigVersion.cmake +20 -0
  530. mqt/core/share/cmake/nlohmann_json/nlohmann_jsonTargets.cmake +109 -0
  531. mqt/core/share/cmake/qdmi/Cache.cmake +44 -0
  532. mqt/core/share/cmake/qdmi/PrefixHandling.cmake +78 -0
  533. mqt/core/share/cmake/qdmi/prefix_defs.txt +26 -0
  534. mqt/core/share/cmake/qdmi/qdmi-config-version.cmake +85 -0
  535. mqt/core/share/cmake/qdmi/qdmi-config.cmake +42 -0
  536. mqt/core/share/cmake/qdmi/qdmi-targets.cmake +129 -0
  537. mqt/core/share/cmake/spdlog/spdlogConfig.cmake +44 -0
  538. mqt/core/share/cmake/spdlog/spdlogConfigTargets-release.cmake +19 -0
  539. mqt/core/share/cmake/spdlog/spdlogConfigTargets.cmake +118 -0
  540. mqt/core/share/cmake/spdlog/spdlogConfigVersion.cmake +65 -0
  541. mqt/core/share/pkgconfig/nlohmann_json.pc +7 -0
  542. mqt_core-3.3.2.dist-info/METADATA +210 -0
  543. mqt_core-3.3.2.dist-info/RECORD +546 -0
  544. mqt_core-3.3.2.dist-info/WHEEL +6 -0
  545. mqt_core-3.3.2.dist-info/entry_points.txt +4 -0
  546. mqt_core-3.3.2.dist-info/licenses/LICENSE.md +22 -0
@@ -0,0 +1,1656 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright 2011 John Maddock. Distributed under the Boost
3
+ // Software License, Version 1.0. (See accompanying file
4
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
+
6
+ #ifndef BOOST_MP_NUMBER_BASE_HPP
7
+ #define BOOST_MP_NUMBER_BASE_HPP
8
+
9
+ #include <climits>
10
+ #include <ios>
11
+ #include <string>
12
+ #include <limits>
13
+ #include <type_traits>
14
+ #include <stdexcept>
15
+ #include <tuple>
16
+ #include <boost/multiprecision/detail/standalone_config.hpp>
17
+ #include <boost/multiprecision/fwd.hpp>
18
+ #include <boost/multiprecision/traits/transcendental_reduction_type.hpp>
19
+ #include <boost/multiprecision/traits/std_integer_traits.hpp>
20
+ #include <boost/multiprecision/detail/no_exceptions_support.hpp>
21
+
22
+ #ifdef BOOST_MSVC
23
+ #pragma warning(push)
24
+ #pragma warning(disable : 4307)
25
+ #pragma warning(pop)
26
+ #endif
27
+
28
+ #ifndef BOOST_MP_STANDALONE
29
+ #include <boost/lexical_cast.hpp>
30
+ #include <boost/core/nvp.hpp>
31
+ #endif
32
+
33
+ #ifdef BOOST_MP_MATH_AVAILABLE
34
+ #include <boost/math/tools/complex.hpp>
35
+ #endif
36
+
37
+ // We now require C++11.
38
+ #include <boost/multiprecision/detail/check_cpp11_config.hpp>
39
+
40
+ #if defined(NDEBUG) && !defined(_DEBUG)
41
+ #define BOOST_MP_FORCEINLINE BOOST_FORCEINLINE
42
+ #else
43
+ #define BOOST_MP_FORCEINLINE inline
44
+ #endif
45
+
46
+ //
47
+ // Thread local storage:
48
+ // Note fails on Mingw, see https://sourceforge.net/p/mingw-w64/bugs/527/
49
+ //
50
+ #if defined(BOOST_NO_CXX11_THREAD_LOCAL)
51
+ #define BOOST_MP_THREAD_LOCAL
52
+ #elif !(defined(__MINGW32__) && (defined(__GNUC__) && (__GNUC__ < 9)) && !defined(__clang__))
53
+ #define BOOST_MP_THREAD_LOCAL thread_local
54
+ #define BOOST_MP_USING_THREAD_LOCAL
55
+ #else
56
+ #pragma GCC warning "thread_local on mingw is broken, please use MSys mingw gcc-9 or later, see https://sourceforge.net/p/mingw-w64/bugs/527/"
57
+ #define BOOST_MP_THREAD_LOCAL
58
+ #endif
59
+
60
+ #ifdef __has_include
61
+ # if __has_include(<version>)
62
+ # include <version>
63
+ # ifdef __cpp_lib_is_constant_evaluated
64
+ # include <type_traits>
65
+ # define BOOST_MP_HAS_IS_CONSTANT_EVALUATED
66
+ # endif
67
+ # endif
68
+ #endif
69
+
70
+ #ifdef __has_builtin
71
+ #if __has_builtin(__builtin_is_constant_evaluated) && !defined(BOOST_NO_CXX14_CONSTEXPR) && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
72
+ #define BOOST_MP_HAS_BUILTIN_IS_CONSTANT_EVALUATED
73
+ #endif
74
+ #endif
75
+ //
76
+ // MSVC also supports __builtin_is_constant_evaluated if it's recent enough:
77
+ //
78
+ #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 192528326)
79
+ # define BOOST_MP_HAS_BUILTIN_IS_CONSTANT_EVALUATED
80
+ #endif
81
+ //
82
+ // As does GCC-9:
83
+ //
84
+ #if defined(BOOST_GCC) && !defined(BOOST_NO_CXX14_CONSTEXPR) && (__GNUC__ >= 9) && !defined(BOOST_MP_HAS_BUILTIN_IS_CONSTANT_EVALUATED)
85
+ # define BOOST_MP_HAS_BUILTIN_IS_CONSTANT_EVALUATED
86
+ #endif
87
+
88
+ #if defined(BOOST_MP_HAS_IS_CONSTANT_EVALUATED) && !defined(BOOST_NO_CXX14_CONSTEXPR)
89
+ # define BOOST_MP_IS_CONST_EVALUATED(x) std::is_constant_evaluated()
90
+ #elif defined(BOOST_MP_HAS_BUILTIN_IS_CONSTANT_EVALUATED)
91
+ # define BOOST_MP_IS_CONST_EVALUATED(x) __builtin_is_constant_evaluated()
92
+ #elif !defined(BOOST_NO_CXX14_CONSTEXPR) && defined(BOOST_GCC) && (__GNUC__ >= 6)
93
+ # define BOOST_MP_IS_CONST_EVALUATED(x) __builtin_constant_p(x)
94
+ #else
95
+ # define BOOST_MP_NO_CONSTEXPR_DETECTION
96
+ #endif
97
+
98
+
99
+ #ifdef BOOST_MP_NO_CONSTEXPR_DETECTION
100
+ # define BOOST_CXX14_CONSTEXPR_IF_DETECTION
101
+ #else
102
+ # define BOOST_CXX14_CONSTEXPR_IF_DETECTION constexpr
103
+ #endif
104
+
105
+ #ifdef BOOST_MSVC
106
+ #pragma warning(push)
107
+ #pragma warning(disable : 6326)
108
+ #endif
109
+
110
+ namespace boost {
111
+ namespace multiprecision {
112
+
113
+
114
+ enum struct variable_precision_options : signed char
115
+ {
116
+ assume_uniform_precision = -1,
117
+ preserve_target_precision = 0,
118
+ preserve_source_precision = 1,
119
+ preserve_component_precision = 2,
120
+ preserve_related_precision = 3,
121
+ preserve_all_precision = 4,
122
+ };
123
+
124
+ inline constexpr bool operator==(variable_precision_options a, variable_precision_options b)
125
+ {
126
+ return static_cast<unsigned>(a) == static_cast<unsigned>(b);
127
+ }
128
+
129
+ template <class T>
130
+ struct is_et_number : public std::integral_constant<bool, false>
131
+ {};
132
+
133
+ template <class Backend>
134
+ struct is_et_number<number<Backend, et_on> > : public std::integral_constant<bool, true>
135
+ {};
136
+
137
+ template <class T>
138
+ struct is_no_et_number : public std::integral_constant<bool, false>
139
+ {};
140
+
141
+ template <class Backend>
142
+ struct is_no_et_number<number<Backend, et_off> > : public std::integral_constant<bool, true>
143
+ {};
144
+
145
+ template <class T>
146
+ struct is_number_expression : public std::integral_constant<bool, false>
147
+ {};
148
+
149
+ template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
150
+ struct is_number_expression<detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > : public std::integral_constant<bool, true>
151
+ {};
152
+
153
+ namespace detail {
154
+ template <class Val, class Backend>
155
+ struct canonical;
156
+ }
157
+
158
+ template <class T, class Num>
159
+ struct is_compatible_arithmetic_type
160
+ : public std::integral_constant<bool,
161
+ std::is_convertible<T, Num>::value && !std::is_same<T, Num>::value && !is_number_expression<T>::value
162
+ && (std::is_constructible<typename Num::backend_type, typename detail::canonical<T, typename Num::backend_type>::type>::value
163
+ || std::is_assignable<typename Num::backend_type, typename detail::canonical<T, typename Num::backend_type>::type>::value || is_number<T>::value || is_number_expression<T>::value)>
164
+ {};
165
+
166
+ namespace detail {
167
+ //
168
+ // Workaround for missing abs(long long) and abs(__int128) on some compilers:
169
+ //
170
+ template <class T>
171
+ constexpr typename std::enable_if<(boost::multiprecision::detail::is_signed<T>::value || std::is_floating_point<T>::value), T>::type abs(T t) noexcept
172
+ {
173
+ // This strange expression avoids a hardware trap in the corner case
174
+ // that val is the most negative value permitted in long long.
175
+ // See https://svn.boost.org/trac/boost/ticket/9740.
176
+ return t < 0 ? T(1u) + T(-(t + 1)) : t;
177
+ }
178
+ template <class T>
179
+ constexpr typename std::enable_if<boost::multiprecision::detail::is_unsigned<T>::value, T>::type abs(T t) noexcept
180
+ {
181
+ return t;
182
+ }
183
+
184
+ #define BOOST_MP_USING_ABS using boost::multiprecision::detail::abs;
185
+
186
+ template <class T>
187
+ constexpr typename std::enable_if<(boost::multiprecision::detail::is_signed<T>::value || std::is_floating_point<T>::value), typename boost::multiprecision::detail::make_unsigned<T>::type>::type unsigned_abs(T t) noexcept
188
+ {
189
+ // This strange expression avoids a hardware trap in the corner case
190
+ // that val is the most negative value permitted in long long.
191
+ // See https://svn.boost.org/trac/boost/ticket/9740.
192
+ return t < 0 ? static_cast<typename boost::multiprecision::detail::make_unsigned<T>::type>(1u) + static_cast<typename boost::multiprecision::detail::make_unsigned<T>::type>(-(t + 1)) : static_cast<typename boost::multiprecision::detail::make_unsigned<T>::type>(t);
193
+ }
194
+ template <class T>
195
+ constexpr typename std::enable_if<boost::multiprecision::detail::is_unsigned<T>::value, T>::type unsigned_abs(T t) noexcept
196
+ {
197
+ return t;
198
+ }
199
+
200
+ template <class T>
201
+ struct bits_of
202
+ {
203
+ static_assert(boost::multiprecision::detail::is_integral<T>::value || std::is_enum<T>::value || std::numeric_limits<T>::is_specialized, "Failed integer size check");
204
+ static constexpr unsigned value =
205
+ std::numeric_limits<T>::is_specialized ? std::numeric_limits<T>::digits
206
+ : sizeof(T) * CHAR_BIT - (boost::multiprecision::detail::is_signed<T>::value ? 1 : 0);
207
+ };
208
+
209
+ #if defined(_GLIBCXX_USE_FLOAT128) && defined(BOOST_GCC) && !defined(__STRICT_ANSI__)
210
+ #define BOOST_MP_BITS_OF_FLOAT128_DEFINED
211
+ template <>
212
+ struct bits_of<float128_type>
213
+ {
214
+ static constexpr unsigned value = 113;
215
+ };
216
+ #endif
217
+
218
+ template <int b>
219
+ struct has_enough_bits
220
+ {
221
+ template <class T>
222
+ struct type : public std::integral_constant<bool, bits_of<T>::value >= b>
223
+ {};
224
+ };
225
+
226
+ template <class Tuple, int i, int digits, bool = (i >= std::tuple_size<Tuple>::value)>
227
+ struct find_index_of_large_enough_type
228
+ {
229
+ static constexpr int value = bits_of<typename std::tuple_element<static_cast<std::size_t>(i), Tuple>::type>::value >= digits ? i : find_index_of_large_enough_type<Tuple, i + 1, digits>::value;
230
+ };
231
+ template <class Tuple, int i, int digits>
232
+ struct find_index_of_large_enough_type<Tuple, i, digits, true>
233
+ {
234
+ static constexpr int value = INT_MAX;
235
+ };
236
+
237
+ template <int index, class Tuple, class Fallback, bool = (std::tuple_size<Tuple>::value <= index)>
238
+ struct dereference_tuple
239
+ {
240
+ using type = typename std::tuple_element<static_cast<std::size_t>(index), Tuple>::type;
241
+ };
242
+ template <int index, class Tuple, class Fallback>
243
+ struct dereference_tuple<index, Tuple, Fallback, true>
244
+ {
245
+ using type = Fallback;
246
+ };
247
+
248
+ template <class Val, class Backend, class Tag>
249
+ struct canonical_imp
250
+ {
251
+ using type = typename std::remove_cv<typename std::decay<const Val>::type>::type;
252
+ };
253
+ template <class B, class Backend, class Tag>
254
+ struct canonical_imp<number<B, et_on>, Backend, Tag>
255
+ {
256
+ using type = B;
257
+ };
258
+ template <class B, class Backend, class Tag>
259
+ struct canonical_imp<number<B, et_off>, Backend, Tag>
260
+ {
261
+ using type = B;
262
+ };
263
+ #ifdef __SUNPRO_CC
264
+ template <class B, class Backend>
265
+ struct canonical_imp<number<B, et_on>, Backend, std::integral_constant<int, 3> >
266
+ {
267
+ using type = B;
268
+ };
269
+ template <class B, class Backend>
270
+ struct canonical_imp<number<B, et_off>, Backend, std::integral_constant<int, 3> >
271
+ {
272
+ using type = B;
273
+ };
274
+ #endif
275
+ template <class Val, class Backend>
276
+ struct canonical_imp<Val, Backend, std::integral_constant<int, 0> >
277
+ {
278
+ static constexpr int index = find_index_of_large_enough_type<typename Backend::signed_types, 0, bits_of<Val>::value>::value;
279
+ using type = typename dereference_tuple<index, typename Backend::signed_types, Val>::type;
280
+ };
281
+ template <class Val, class Backend>
282
+ struct canonical_imp<Val, Backend, std::integral_constant<int, 1> >
283
+ {
284
+ static constexpr int index = find_index_of_large_enough_type<typename Backend::unsigned_types, 0, bits_of<Val>::value>::value;
285
+ using type = typename dereference_tuple<index, typename Backend::unsigned_types, Val>::type;
286
+ };
287
+ template <class Val, class Backend>
288
+ struct canonical_imp<Val, Backend, std::integral_constant<int, 2> >
289
+ {
290
+ static constexpr int index = find_index_of_large_enough_type<typename Backend::float_types, 0, bits_of<Val>::value>::value;
291
+ using type = typename dereference_tuple<index, typename Backend::float_types, Val>::type;
292
+ };
293
+ template <class Val, class Backend>
294
+ struct canonical_imp<Val, Backend, std::integral_constant<int, 3> >
295
+ {
296
+ using type = const char*;
297
+ };
298
+ template <class Val, class Backend>
299
+ struct canonical_imp<Val, Backend, std::integral_constant<int, 4> >
300
+ {
301
+ using underlying = typename std::underlying_type<Val>::type;
302
+ using tag = typename std::conditional<boost::multiprecision::detail::is_signed<Val>::value, std::integral_constant<int, 0>, std::integral_constant<int, 1>>::type;
303
+ using type = typename canonical_imp<underlying, Backend, tag>::type;
304
+ };
305
+
306
+ template <class Val, class Backend>
307
+ struct canonical
308
+ {
309
+ using tag_type = typename std::conditional<
310
+ boost::multiprecision::detail::is_signed<Val>::value && boost::multiprecision::detail::is_integral<Val>::value,
311
+ std::integral_constant<int, 0>,
312
+ typename std::conditional<
313
+ boost::multiprecision::detail::is_unsigned<Val>::value,
314
+ std::integral_constant<int, 1>,
315
+ typename std::conditional<
316
+ std::is_floating_point<Val>::value,
317
+ std::integral_constant<int, 2>,
318
+ typename std::conditional<
319
+ (std::is_convertible<Val, const char*>::value || std::is_same<Val, std::string>::value),
320
+ std::integral_constant<int, 3>,
321
+ typename std::conditional<
322
+ std::is_enum<Val>::value,
323
+ std::integral_constant<int, 4>,
324
+ std::integral_constant<int, 5> >::type>::type>::type>::type>::type;
325
+
326
+ using type = typename canonical_imp<Val, Backend, tag_type>::type;
327
+ };
328
+
329
+ struct terminal
330
+ {};
331
+ struct negate
332
+ {};
333
+ struct plus
334
+ {};
335
+ struct minus
336
+ {};
337
+ struct multiplies
338
+ {};
339
+ struct divides
340
+ {};
341
+ struct modulus
342
+ {};
343
+ struct shift_left
344
+ {};
345
+ struct shift_right
346
+ {};
347
+ struct bitwise_and
348
+ {};
349
+ struct bitwise_or
350
+ {};
351
+ struct bitwise_xor
352
+ {};
353
+ struct bitwise_complement
354
+ {};
355
+ struct add_immediates
356
+ {};
357
+ struct subtract_immediates
358
+ {};
359
+ struct multiply_immediates
360
+ {};
361
+ struct divide_immediates
362
+ {};
363
+ struct modulus_immediates
364
+ {};
365
+ struct bitwise_and_immediates
366
+ {};
367
+ struct bitwise_or_immediates
368
+ {};
369
+ struct bitwise_xor_immediates
370
+ {};
371
+ struct complement_immediates
372
+ {};
373
+ struct function
374
+ {};
375
+ struct multiply_add
376
+ {};
377
+ struct multiply_subtract
378
+ {};
379
+
380
+ template <class T>
381
+ struct backend_type;
382
+
383
+ template <class T, expression_template_option ExpressionTemplates>
384
+ struct backend_type<number<T, ExpressionTemplates> >
385
+ {
386
+ using type = T;
387
+ };
388
+
389
+ template <class tag, class A1, class A2, class A3, class A4>
390
+ struct backend_type<expression<tag, A1, A2, A3, A4> >
391
+ {
392
+ using type = typename backend_type<typename expression<tag, A1, A2, A3, A4>::result_type>::type;
393
+ };
394
+
395
+ template <class T1, class T2>
396
+ struct combine_expression
397
+ {
398
+ using type = decltype(T1() + T2());
399
+ };
400
+
401
+ template <class T1, expression_template_option ExpressionTemplates, class T2>
402
+ struct combine_expression<number<T1, ExpressionTemplates>, T2>
403
+ {
404
+ using type = number<T1, ExpressionTemplates>;
405
+ };
406
+
407
+ template <class T1, class T2, expression_template_option ExpressionTemplates>
408
+ struct combine_expression<T1, number<T2, ExpressionTemplates> >
409
+ {
410
+ using type = number<T2, ExpressionTemplates>;
411
+ };
412
+
413
+ template <class T, expression_template_option ExpressionTemplates>
414
+ struct combine_expression<number<T, ExpressionTemplates>, number<T, ExpressionTemplates> >
415
+ {
416
+ using type = number<T, ExpressionTemplates>;
417
+ };
418
+
419
+ template <class T1, expression_template_option ExpressionTemplates1, class T2, expression_template_option ExpressionTemplates2>
420
+ struct combine_expression<number<T1, ExpressionTemplates1>, number<T2, ExpressionTemplates2> >
421
+ {
422
+ using type = typename std::conditional<
423
+ std::is_convertible<number<T2, ExpressionTemplates2>, number<T1, ExpressionTemplates2> >::value,
424
+ number<T1, ExpressionTemplates1>,
425
+ number<T2, ExpressionTemplates2> >::type;
426
+ };
427
+
428
+ template <class T>
429
+ struct arg_type
430
+ {
431
+ using type = expression<terminal, T>;
432
+ };
433
+
434
+ template <class Tag, class Arg1, class Arg2, class Arg3, class Arg4>
435
+ struct arg_type<expression<Tag, Arg1, Arg2, Arg3, Arg4> >
436
+ {
437
+ using type = expression<Tag, Arg1, Arg2, Arg3, Arg4>;
438
+ };
439
+
440
+ struct unmentionable
441
+ {
442
+ unmentionable* proc() { return nullptr; }
443
+ };
444
+
445
+ typedef unmentionable* (unmentionable::*unmentionable_type)();
446
+
447
+ template <class T, bool b>
448
+ struct expression_storage_base
449
+ {
450
+ using type = const T&;
451
+ };
452
+
453
+ template <class T>
454
+ struct expression_storage_base<T, true>
455
+ {
456
+ using type = T;
457
+ };
458
+
459
+ template <class T>
460
+ struct expression_storage : public expression_storage_base<T, boost::multiprecision::detail::is_arithmetic<T>::value>
461
+ {};
462
+
463
+ template <class T>
464
+ struct expression_storage<T*>
465
+ {
466
+ using type = T*;
467
+ };
468
+
469
+ template <class T>
470
+ struct expression_storage<const T*>
471
+ {
472
+ using type = const T*;
473
+ };
474
+
475
+ template <class tag, class A1, class A2, class A3, class A4>
476
+ struct expression_storage<expression<tag, A1, A2, A3, A4> >
477
+ {
478
+ using type = expression<tag, A1, A2, A3, A4>;
479
+ };
480
+
481
+ template <class tag, class Arg1>
482
+ struct expression<tag, Arg1, void, void, void>
483
+ {
484
+ using arity = std::integral_constant<int, 1> ;
485
+ using left_type = typename arg_type<Arg1>::type ;
486
+ using left_result_type = typename left_type::result_type;
487
+ using result_type = typename left_type::result_type;
488
+ using tag_type = tag ;
489
+
490
+ explicit BOOST_MP_CXX14_CONSTEXPR expression(const Arg1& a) : arg(a) {}
491
+ BOOST_MP_CXX14_CONSTEXPR expression(const expression& e) : arg(e.arg) {}
492
+
493
+ //
494
+ // If we have static_assert we can give a more useful error message
495
+ // than if we simply have no operator defined at all:
496
+ //
497
+ template <class Other>
498
+ BOOST_MP_CXX14_CONSTEXPR expression& operator=(const Other&)
499
+ {
500
+ // This should always fail:
501
+ static_assert(sizeof(Other) == INT_MAX, "You can not assign to a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
502
+ return *this;
503
+ }
504
+ BOOST_MP_CXX14_CONSTEXPR expression& operator++()
505
+ {
506
+ // This should always fail:
507
+ static_assert(sizeof(*this) == INT_MAX, "You can not increment a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
508
+ return *this;
509
+ }
510
+ BOOST_MP_CXX14_CONSTEXPR expression& operator++(int)
511
+ {
512
+ // This should always fail:
513
+ static_assert(sizeof(*this) == INT_MAX, "You can not increment a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
514
+ return *this;
515
+ }
516
+ BOOST_MP_CXX14_CONSTEXPR expression& operator--()
517
+ {
518
+ // This should always fail:
519
+ static_assert(sizeof(*this) == INT_MAX, "You can not decrement a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
520
+ return *this;
521
+ }
522
+ BOOST_MP_CXX14_CONSTEXPR expression& operator--(int)
523
+ {
524
+ // This should always fail:
525
+ static_assert(sizeof(*this) == INT_MAX, "You can not decrement a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
526
+ return *this;
527
+ }
528
+ template <class Other>
529
+ BOOST_MP_CXX14_CONSTEXPR expression& operator+=(const Other&)
530
+ {
531
+ // This should always fail:
532
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator+= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
533
+ return *this;
534
+ }
535
+ template <class Other>
536
+ BOOST_MP_CXX14_CONSTEXPR expression& operator-=(const Other&)
537
+ {
538
+ // This should always fail:
539
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator-= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
540
+ return *this;
541
+ }
542
+ template <class Other>
543
+ BOOST_MP_CXX14_CONSTEXPR expression& operator*=(const Other&)
544
+ {
545
+ // This should always fail:
546
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator*= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
547
+ return *this;
548
+ }
549
+ template <class Other>
550
+ BOOST_MP_CXX14_CONSTEXPR expression& operator/=(const Other&)
551
+ {
552
+ // This should always fail:
553
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator/= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
554
+ return *this;
555
+ }
556
+ template <class Other>
557
+ BOOST_MP_CXX14_CONSTEXPR expression& operator%=(const Other&)
558
+ {
559
+ // This should always fail:
560
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator%= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
561
+ return *this;
562
+ }
563
+ template <class Other>
564
+ BOOST_MP_CXX14_CONSTEXPR expression& operator|=(const Other&)
565
+ {
566
+ // This should always fail:
567
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator|= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
568
+ return *this;
569
+ }
570
+ template <class Other>
571
+ BOOST_MP_CXX14_CONSTEXPR expression& operator&=(const Other&)
572
+ {
573
+ // This should always fail:
574
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator&= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
575
+ return *this;
576
+ }
577
+ template <class Other>
578
+ BOOST_MP_CXX14_CONSTEXPR expression& operator^=(const Other&)
579
+ {
580
+ // This should always fail:
581
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator^= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
582
+ return *this;
583
+ }
584
+ template <class Other>
585
+ BOOST_MP_CXX14_CONSTEXPR expression& operator<<=(const Other&)
586
+ {
587
+ // This should always fail:
588
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator<<= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
589
+ return *this;
590
+ }
591
+ template <class Other>
592
+ BOOST_MP_CXX14_CONSTEXPR expression& operator>>=(const Other&)
593
+ {
594
+ // This should always fail:
595
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator>>= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
596
+ return *this;
597
+ }
598
+
599
+ BOOST_MP_CXX14_CONSTEXPR left_type left() const
600
+ {
601
+ return left_type(arg);
602
+ }
603
+
604
+ BOOST_MP_CXX14_CONSTEXPR const Arg1& left_ref() const noexcept { return arg; }
605
+
606
+ static constexpr unsigned depth = left_type::depth + 1;
607
+ template <class T
608
+ #ifndef __SUNPRO_CC
609
+ ,
610
+ typename std::enable_if<!is_number<T>::value && !std::is_convertible<result_type, T const&>::value && std::is_constructible<T, result_type>::value, int>::type = 0
611
+ #endif
612
+ >
613
+ explicit BOOST_MP_CXX14_CONSTEXPR operator T() const
614
+ {
615
+ return static_cast<T>(static_cast<result_type>(*this));
616
+ }
617
+ BOOST_MP_FORCEINLINE explicit BOOST_MP_CXX14_CONSTEXPR operator bool() const
618
+ {
619
+ result_type r(*this);
620
+ return static_cast<bool>(r);
621
+ }
622
+
623
+ template <class T>
624
+ BOOST_MP_CXX14_CONSTEXPR T convert_to()
625
+ {
626
+ result_type r(*this);
627
+ return r.template convert_to<T>();
628
+ }
629
+
630
+ private:
631
+ typename expression_storage<Arg1>::type arg;
632
+ expression& operator=(const expression&);
633
+ };
634
+
635
+ template <class Arg1>
636
+ struct expression<terminal, Arg1, void, void, void>
637
+ {
638
+ using arity = std::integral_constant<int, 0>;
639
+ using result_type = Arg1 ;
640
+ using tag_type = terminal ;
641
+
642
+ explicit BOOST_MP_CXX14_CONSTEXPR expression(const Arg1& a) : arg(a) {}
643
+ BOOST_MP_CXX14_CONSTEXPR expression(const expression& e) : arg(e.arg) {}
644
+
645
+ //
646
+ // If we have static_assert we can give a more useful error message
647
+ // than if we simply have no operator defined at all:
648
+ //
649
+ template <class Other>
650
+ BOOST_MP_CXX14_CONSTEXPR expression& operator=(const Other&)
651
+ {
652
+ // This should always fail:
653
+ static_assert(sizeof(Other) == INT_MAX, "You can not assign to a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
654
+ return *this;
655
+ }
656
+ BOOST_MP_CXX14_CONSTEXPR expression& operator++()
657
+ {
658
+ // This should always fail:
659
+ static_assert(sizeof(*this) == INT_MAX, "You can not increment a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
660
+ return *this;
661
+ }
662
+ BOOST_MP_CXX14_CONSTEXPR expression& operator++(int)
663
+ {
664
+ // This should always fail:
665
+ static_assert(sizeof(*this) == INT_MAX, "You can not increment a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
666
+ return *this;
667
+ }
668
+ BOOST_MP_CXX14_CONSTEXPR expression& operator--()
669
+ {
670
+ // This should always fail:
671
+ static_assert(sizeof(*this) == INT_MAX, "You can not decrement a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
672
+ return *this;
673
+ }
674
+ BOOST_MP_CXX14_CONSTEXPR expression& operator--(int)
675
+ {
676
+ // This should always fail:
677
+ static_assert(sizeof(*this) == INT_MAX, "You can not decrement a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
678
+ return *this;
679
+ }
680
+ template <class Other>
681
+ BOOST_MP_CXX14_CONSTEXPR expression& operator+=(const Other&)
682
+ {
683
+ // This should always fail:
684
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator+= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
685
+ return *this;
686
+ }
687
+ template <class Other>
688
+ BOOST_MP_CXX14_CONSTEXPR expression& operator-=(const Other&)
689
+ {
690
+ // This should always fail:
691
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator-= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
692
+ return *this;
693
+ }
694
+ template <class Other>
695
+ BOOST_MP_CXX14_CONSTEXPR expression& operator*=(const Other&)
696
+ {
697
+ // This should always fail:
698
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator*= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
699
+ return *this;
700
+ }
701
+ template <class Other>
702
+ BOOST_MP_CXX14_CONSTEXPR expression& operator/=(const Other&)
703
+ {
704
+ // This should always fail:
705
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator/= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
706
+ return *this;
707
+ }
708
+ template <class Other>
709
+ BOOST_MP_CXX14_CONSTEXPR expression& operator%=(const Other&)
710
+ {
711
+ // This should always fail:
712
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator%= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
713
+ return *this;
714
+ }
715
+ template <class Other>
716
+ BOOST_MP_CXX14_CONSTEXPR expression& operator|=(const Other&)
717
+ {
718
+ // This should always fail:
719
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator|= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
720
+ return *this;
721
+ }
722
+ template <class Other>
723
+ BOOST_MP_CXX14_CONSTEXPR expression& operator&=(const Other&)
724
+ {
725
+ // This should always fail:
726
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator&= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
727
+ return *this;
728
+ }
729
+ template <class Other>
730
+ BOOST_MP_CXX14_CONSTEXPR expression& operator^=(const Other&)
731
+ {
732
+ // This should always fail:
733
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator^= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
734
+ return *this;
735
+ }
736
+ template <class Other>
737
+ BOOST_MP_CXX14_CONSTEXPR expression& operator<<=(const Other&)
738
+ {
739
+ // This should always fail:
740
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator<<= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
741
+ return *this;
742
+ }
743
+ template <class Other>
744
+ BOOST_MP_CXX14_CONSTEXPR expression& operator>>=(const Other&)
745
+ {
746
+ // This should always fail:
747
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator>>= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
748
+ return *this;
749
+ }
750
+
751
+ BOOST_MP_CXX14_CONSTEXPR const Arg1& value() const noexcept
752
+ {
753
+ return arg;
754
+ }
755
+
756
+ static constexpr unsigned depth = 0;
757
+
758
+ template <class T
759
+ #ifndef __SUNPRO_CC
760
+ ,
761
+ typename std::enable_if<!is_number<T>::value && !std::is_convertible<result_type, T const&>::value && std::is_constructible<T, result_type>::value, int>::type = 0
762
+ #endif
763
+ >
764
+ explicit BOOST_MP_CXX14_CONSTEXPR operator T() const
765
+ {
766
+ return static_cast<T>(static_cast<result_type>(*this));
767
+ }
768
+ BOOST_MP_FORCEINLINE explicit BOOST_MP_CXX14_CONSTEXPR operator bool() const
769
+ {
770
+ result_type r(*this);
771
+ return static_cast<bool>(r);
772
+ }
773
+
774
+ template <class T>
775
+ BOOST_MP_CXX14_CONSTEXPR T convert_to()
776
+ {
777
+ result_type r(*this);
778
+ return r.template convert_to<T>();
779
+ }
780
+
781
+ private:
782
+ typename expression_storage<Arg1>::type arg;
783
+ expression& operator=(const expression&);
784
+ };
785
+
786
+ template <class tag, class Arg1, class Arg2>
787
+ struct expression<tag, Arg1, Arg2, void, void>
788
+ {
789
+ using arity = std::integral_constant<int, 2> ;
790
+ using left_type = typename arg_type<Arg1>::type ;
791
+ using right_type = typename arg_type<Arg2>::type ;
792
+ using left_result_type = typename left_type::result_type ;
793
+ using right_result_type = typename right_type::result_type ;
794
+ using result_type = typename combine_expression<left_result_type, right_result_type>::type;
795
+ using tag_type = tag ;
796
+
797
+ BOOST_MP_CXX14_CONSTEXPR expression(const Arg1& a1, const Arg2& a2) : arg1(a1), arg2(a2) {}
798
+ BOOST_MP_CXX14_CONSTEXPR expression(const expression& e) : arg1(e.arg1), arg2(e.arg2) {}
799
+
800
+ //
801
+ // If we have static_assert we can give a more useful error message
802
+ // than if we simply have no operator defined at all:
803
+ //
804
+ template <class Other>
805
+ BOOST_MP_CXX14_CONSTEXPR expression& operator=(const Other&)
806
+ {
807
+ // This should always fail:
808
+ static_assert(sizeof(Other) == INT_MAX, "You can not assign to a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
809
+ return *this;
810
+ }
811
+ BOOST_MP_CXX14_CONSTEXPR expression& operator++()
812
+ {
813
+ // This should always fail:
814
+ static_assert(sizeof(*this) == INT_MAX, "You can not increment a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
815
+ return *this;
816
+ }
817
+ BOOST_MP_CXX14_CONSTEXPR expression& operator++(int)
818
+ {
819
+ // This should always fail:
820
+ static_assert(sizeof(*this) == INT_MAX, "You can not increment a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
821
+ return *this;
822
+ }
823
+ BOOST_MP_CXX14_CONSTEXPR expression& operator--()
824
+ {
825
+ // This should always fail:
826
+ static_assert(sizeof(*this) == INT_MAX, "You can not decrement a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
827
+ return *this;
828
+ }
829
+ BOOST_MP_CXX14_CONSTEXPR expression& operator--(int)
830
+ {
831
+ // This should always fail:
832
+ static_assert(sizeof(*this) == INT_MAX, "You can not decrement a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
833
+ return *this;
834
+ }
835
+ template <class Other>
836
+ BOOST_MP_CXX14_CONSTEXPR expression& operator+=(const Other&)
837
+ {
838
+ // This should always fail:
839
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator+= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
840
+ return *this;
841
+ }
842
+ template <class Other>
843
+ BOOST_MP_CXX14_CONSTEXPR expression& operator-=(const Other&)
844
+ {
845
+ // This should always fail:
846
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator-= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
847
+ return *this;
848
+ }
849
+ template <class Other>
850
+ BOOST_MP_CXX14_CONSTEXPR expression& operator*=(const Other&)
851
+ {
852
+ // This should always fail:
853
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator*= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
854
+ return *this;
855
+ }
856
+ template <class Other>
857
+ BOOST_MP_CXX14_CONSTEXPR expression& operator/=(const Other&)
858
+ {
859
+ // This should always fail:
860
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator/= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
861
+ return *this;
862
+ }
863
+ template <class Other>
864
+ BOOST_MP_CXX14_CONSTEXPR expression& operator%=(const Other&)
865
+ {
866
+ // This should always fail:
867
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator%= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
868
+ return *this;
869
+ }
870
+ template <class Other>
871
+ BOOST_MP_CXX14_CONSTEXPR expression& operator|=(const Other&)
872
+ {
873
+ // This should always fail:
874
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator|= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
875
+ return *this;
876
+ }
877
+ template <class Other>
878
+ BOOST_MP_CXX14_CONSTEXPR expression& operator&=(const Other&)
879
+ {
880
+ // This should always fail:
881
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator&= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
882
+ return *this;
883
+ }
884
+ template <class Other>
885
+ BOOST_MP_CXX14_CONSTEXPR expression& operator^=(const Other&)
886
+ {
887
+ // This should always fail:
888
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator^= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
889
+ return *this;
890
+ }
891
+ template <class Other>
892
+ BOOST_MP_CXX14_CONSTEXPR expression& operator<<=(const Other&)
893
+ {
894
+ // This should always fail:
895
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator<<= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
896
+ return *this;
897
+ }
898
+ template <class Other>
899
+ BOOST_MP_CXX14_CONSTEXPR expression& operator>>=(const Other&)
900
+ {
901
+ // This should always fail:
902
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator>>= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
903
+ return *this;
904
+ }
905
+
906
+ BOOST_MP_CXX14_CONSTEXPR left_type left() const
907
+ {
908
+ return left_type(arg1);
909
+ }
910
+ BOOST_MP_CXX14_CONSTEXPR right_type right() const { return right_type(arg2); }
911
+ BOOST_MP_CXX14_CONSTEXPR const Arg1& left_ref() const noexcept { return arg1; }
912
+ BOOST_MP_CXX14_CONSTEXPR const Arg2& right_ref() const noexcept { return arg2; }
913
+
914
+ template <class T
915
+ #ifndef __SUNPRO_CC
916
+ ,
917
+ typename std::enable_if<!is_number<T>::value && !std::is_convertible<result_type, T const&>::value && std::is_constructible<T, result_type>::value, int>::type = 0
918
+ #endif
919
+ >
920
+ explicit BOOST_MP_CXX14_CONSTEXPR operator T() const
921
+ {
922
+ return static_cast<T>(static_cast<result_type>(*this));
923
+ }
924
+ BOOST_MP_FORCEINLINE explicit BOOST_MP_CXX14_CONSTEXPR operator bool() const
925
+ {
926
+ result_type r(*this);
927
+ return static_cast<bool>(r);
928
+ }
929
+ template <class T>
930
+ BOOST_MP_CXX14_CONSTEXPR T convert_to()
931
+ {
932
+ result_type r(*this);
933
+ return r.template convert_to<T>();
934
+ }
935
+
936
+ static const constexpr unsigned left_depth = left_type::depth + 1;
937
+ static const constexpr unsigned right_depth = right_type::depth + 1;
938
+ static const constexpr unsigned depth = left_depth > right_depth ? left_depth : right_depth;
939
+
940
+ private:
941
+ typename expression_storage<Arg1>::type arg1;
942
+ typename expression_storage<Arg2>::type arg2;
943
+ expression& operator=(const expression&);
944
+ };
945
+
946
+ template <class tag, class Arg1, class Arg2, class Arg3>
947
+ struct expression<tag, Arg1, Arg2, Arg3, void>
948
+ {
949
+ using arity = std::integral_constant<int, 3> ;
950
+ using left_type = typename arg_type<Arg1>::type ;
951
+ using middle_type = typename arg_type<Arg2>::type ;
952
+ using right_type = typename arg_type<Arg3>::type ;
953
+ using left_result_type = typename left_type::result_type ;
954
+ using middle_result_type = typename middle_type::result_type;
955
+ using right_result_type = typename right_type::result_type ;
956
+ using result_type = typename combine_expression<
957
+ left_result_type,
958
+ typename combine_expression<right_result_type, middle_result_type>::type>::type;
959
+ using tag_type = tag ;
960
+
961
+ BOOST_MP_CXX14_CONSTEXPR expression(const Arg1& a1, const Arg2& a2, const Arg3& a3) : arg1(a1), arg2(a2), arg3(a3) {}
962
+ BOOST_MP_CXX14_CONSTEXPR expression(const expression& e) : arg1(e.arg1), arg2(e.arg2), arg3(e.arg3) {}
963
+
964
+ //
965
+ // If we have static_assert we can give a more useful error message
966
+ // than if we simply have no operator defined at all:
967
+ //
968
+ template <class Other>
969
+ BOOST_MP_CXX14_CONSTEXPR expression& operator=(const Other&)
970
+ {
971
+ // This should always fail:
972
+ static_assert(sizeof(Other) == INT_MAX, "You can not assign to a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
973
+ return *this;
974
+ }
975
+ BOOST_MP_CXX14_CONSTEXPR expression& operator++()
976
+ {
977
+ // This should always fail:
978
+ static_assert(sizeof(*this) == INT_MAX, "You can not increment a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
979
+ return *this;
980
+ }
981
+ BOOST_MP_CXX14_CONSTEXPR expression& operator++(int)
982
+ {
983
+ // This should always fail:
984
+ static_assert(sizeof(*this) == INT_MAX, "You can not increment a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
985
+ return *this;
986
+ }
987
+ BOOST_MP_CXX14_CONSTEXPR expression& operator--()
988
+ {
989
+ // This should always fail:
990
+ static_assert(sizeof(*this) == INT_MAX, "You can not decrement a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
991
+ return *this;
992
+ }
993
+ BOOST_MP_CXX14_CONSTEXPR expression& operator--(int)
994
+ {
995
+ // This should always fail:
996
+ static_assert(sizeof(*this) == INT_MAX, "You can not decrement a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
997
+ return *this;
998
+ }
999
+ template <class Other>
1000
+ BOOST_MP_CXX14_CONSTEXPR expression& operator+=(const Other&)
1001
+ {
1002
+ // This should always fail:
1003
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator+= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1004
+ return *this;
1005
+ }
1006
+ template <class Other>
1007
+ BOOST_MP_CXX14_CONSTEXPR expression& operator-=(const Other&)
1008
+ {
1009
+ // This should always fail:
1010
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator-= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1011
+ return *this;
1012
+ }
1013
+ template <class Other>
1014
+ BOOST_MP_CXX14_CONSTEXPR expression& operator*=(const Other&)
1015
+ {
1016
+ // This should always fail:
1017
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator*= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1018
+ return *this;
1019
+ }
1020
+ template <class Other>
1021
+ BOOST_MP_CXX14_CONSTEXPR expression& operator/=(const Other&)
1022
+ {
1023
+ // This should always fail:
1024
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator/= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1025
+ return *this;
1026
+ }
1027
+ template <class Other>
1028
+ BOOST_MP_CXX14_CONSTEXPR expression& operator%=(const Other&)
1029
+ {
1030
+ // This should always fail:
1031
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator%= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1032
+ return *this;
1033
+ }
1034
+ template <class Other>
1035
+ BOOST_MP_CXX14_CONSTEXPR expression& operator|=(const Other&)
1036
+ {
1037
+ // This should always fail:
1038
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator|= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1039
+ return *this;
1040
+ }
1041
+ template <class Other>
1042
+ BOOST_MP_CXX14_CONSTEXPR expression& operator&=(const Other&)
1043
+ {
1044
+ // This should always fail:
1045
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator&= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1046
+ return *this;
1047
+ }
1048
+ template <class Other>
1049
+ BOOST_MP_CXX14_CONSTEXPR expression& operator^=(const Other&)
1050
+ {
1051
+ // This should always fail:
1052
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator^= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1053
+ return *this;
1054
+ }
1055
+ template <class Other>
1056
+ BOOST_MP_CXX14_CONSTEXPR expression& operator<<=(const Other&)
1057
+ {
1058
+ // This should always fail:
1059
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator<<= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1060
+ return *this;
1061
+ }
1062
+ template <class Other>
1063
+ BOOST_MP_CXX14_CONSTEXPR expression& operator>>=(const Other&)
1064
+ {
1065
+ // This should always fail:
1066
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator>>= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1067
+ return *this;
1068
+ }
1069
+
1070
+ BOOST_MP_CXX14_CONSTEXPR left_type left() const
1071
+ {
1072
+ return left_type(arg1);
1073
+ }
1074
+ BOOST_MP_CXX14_CONSTEXPR middle_type middle() const { return middle_type(arg2); }
1075
+ BOOST_MP_CXX14_CONSTEXPR right_type right() const { return right_type(arg3); }
1076
+ BOOST_MP_CXX14_CONSTEXPR const Arg1& left_ref() const noexcept { return arg1; }
1077
+ BOOST_MP_CXX14_CONSTEXPR const Arg2& middle_ref() const noexcept { return arg2; }
1078
+ BOOST_MP_CXX14_CONSTEXPR const Arg3& right_ref() const noexcept { return arg3; }
1079
+
1080
+ template <class T
1081
+ #ifndef __SUNPRO_CC
1082
+ ,
1083
+ typename std::enable_if<!is_number<T>::value && !std::is_convertible<result_type, T const&>::value && std::is_constructible<T, result_type>::value, int>::type = 0
1084
+ #endif
1085
+ >
1086
+ explicit BOOST_MP_CXX14_CONSTEXPR operator T() const
1087
+ {
1088
+ return static_cast<T>(static_cast<result_type>(*this));
1089
+ }
1090
+ BOOST_MP_FORCEINLINE explicit BOOST_MP_CXX14_CONSTEXPR operator bool() const
1091
+ {
1092
+ result_type r(*this);
1093
+ return static_cast<bool>(r);
1094
+ }
1095
+ template <class T>
1096
+ BOOST_MP_CXX14_CONSTEXPR T convert_to()
1097
+ {
1098
+ result_type r(*this);
1099
+ return r.template convert_to<T>();
1100
+ }
1101
+
1102
+ static constexpr unsigned left_depth = left_type::depth + 1;
1103
+ static constexpr unsigned middle_depth = middle_type::depth + 1;
1104
+ static constexpr unsigned right_depth = right_type::depth + 1;
1105
+ static constexpr unsigned depth = left_depth > right_depth ? (left_depth > middle_depth ? left_depth : middle_depth) : (right_depth > middle_depth ? right_depth : middle_depth);
1106
+
1107
+ private:
1108
+ typename expression_storage<Arg1>::type arg1;
1109
+ typename expression_storage<Arg2>::type arg2;
1110
+ typename expression_storage<Arg3>::type arg3;
1111
+ expression& operator=(const expression&);
1112
+ };
1113
+
1114
+ template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
1115
+ struct expression
1116
+ {
1117
+ using arity = std::integral_constant<int, 4> ;
1118
+ using left_type = typename arg_type<Arg1>::type ;
1119
+ using left_middle_type = typename arg_type<Arg2>::type ;
1120
+ using right_middle_type = typename arg_type<Arg3>::type ;
1121
+ using right_type = typename arg_type<Arg4>::type ;
1122
+ using left_result_type = typename left_type::result_type ;
1123
+ using left_middle_result_type = typename left_middle_type::result_type ;
1124
+ using right_middle_result_type = typename right_middle_type::result_type;
1125
+ using right_result_type = typename right_type::result_type ;
1126
+ using result_type = typename combine_expression<
1127
+ left_result_type,
1128
+ typename combine_expression<
1129
+ left_middle_result_type,
1130
+ typename combine_expression<right_middle_result_type, right_result_type>::type>::type>::type;
1131
+ using tag_type = tag ;
1132
+
1133
+ BOOST_MP_CXX14_CONSTEXPR expression(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4) : arg1(a1), arg2(a2), arg3(a3), arg4(a4) {}
1134
+ BOOST_MP_CXX14_CONSTEXPR expression(const expression& e) : arg1(e.arg1), arg2(e.arg2), arg3(e.arg3), arg4(e.arg4) {}
1135
+
1136
+ //
1137
+ // If we have static_assert we can give a more useful error message
1138
+ // than if we simply have no operator defined at all:
1139
+ //
1140
+ template <class Other>
1141
+ BOOST_MP_CXX14_CONSTEXPR expression& operator=(const Other&)
1142
+ {
1143
+ // This should always fail:
1144
+ static_assert(sizeof(Other) == INT_MAX, "You can not assign to a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1145
+ return *this;
1146
+ }
1147
+ BOOST_MP_CXX14_CONSTEXPR expression& operator++()
1148
+ {
1149
+ // This should always fail:
1150
+ static_assert(sizeof(*this) == INT_MAX, "You can not increment a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1151
+ return *this;
1152
+ }
1153
+ BOOST_MP_CXX14_CONSTEXPR expression& operator++(int)
1154
+ {
1155
+ // This should always fail:
1156
+ static_assert(sizeof(*this) == INT_MAX, "You can not increment a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1157
+ return *this;
1158
+ }
1159
+ BOOST_MP_CXX14_CONSTEXPR expression& operator--()
1160
+ {
1161
+ // This should always fail:
1162
+ static_assert(sizeof(*this) == INT_MAX, "You can not decrement a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1163
+ return *this;
1164
+ }
1165
+ BOOST_MP_CXX14_CONSTEXPR expression& operator--(int)
1166
+ {
1167
+ // This should always fail:
1168
+ static_assert(sizeof(*this) == INT_MAX, "You can not decrement a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1169
+ return *this;
1170
+ }
1171
+ template <class Other>
1172
+ BOOST_MP_CXX14_CONSTEXPR expression& operator+=(const Other&)
1173
+ {
1174
+ // This should always fail:
1175
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator+= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1176
+ return *this;
1177
+ }
1178
+ template <class Other>
1179
+ BOOST_MP_CXX14_CONSTEXPR expression& operator-=(const Other&)
1180
+ {
1181
+ // This should always fail:
1182
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator-= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1183
+ return *this;
1184
+ }
1185
+ template <class Other>
1186
+ BOOST_MP_CXX14_CONSTEXPR expression& operator*=(const Other&)
1187
+ {
1188
+ // This should always fail:
1189
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator*= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1190
+ return *this;
1191
+ }
1192
+ template <class Other>
1193
+ BOOST_MP_CXX14_CONSTEXPR expression& operator/=(const Other&)
1194
+ {
1195
+ // This should always fail:
1196
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator/= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1197
+ return *this;
1198
+ }
1199
+ template <class Other>
1200
+ BOOST_MP_CXX14_CONSTEXPR expression& operator%=(const Other&)
1201
+ {
1202
+ // This should always fail:
1203
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator%= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1204
+ return *this;
1205
+ }
1206
+ template <class Other>
1207
+ BOOST_MP_CXX14_CONSTEXPR expression& operator|=(const Other&)
1208
+ {
1209
+ // This should always fail:
1210
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator|= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1211
+ return *this;
1212
+ }
1213
+ template <class Other>
1214
+ BOOST_MP_CXX14_CONSTEXPR expression& operator&=(const Other&)
1215
+ {
1216
+ // This should always fail:
1217
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator&= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1218
+ return *this;
1219
+ }
1220
+ template <class Other>
1221
+ BOOST_MP_CXX14_CONSTEXPR expression& operator^=(const Other&)
1222
+ {
1223
+ // This should always fail:
1224
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator^= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1225
+ return *this;
1226
+ }
1227
+ template <class Other>
1228
+ BOOST_MP_CXX14_CONSTEXPR expression& operator<<=(const Other&)
1229
+ {
1230
+ // This should always fail:
1231
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator<<= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1232
+ return *this;
1233
+ }
1234
+ template <class Other>
1235
+ BOOST_MP_CXX14_CONSTEXPR expression& operator>>=(const Other&)
1236
+ {
1237
+ // This should always fail:
1238
+ static_assert(sizeof(Other) == INT_MAX, "You can not use operator>>= on a Boost.Multiprecision expression template: did you inadvertantly store an expression template in a \"auto\" variable? Or pass an expression to a template function with deduced temnplate arguments?");
1239
+ return *this;
1240
+ }
1241
+
1242
+ BOOST_MP_CXX14_CONSTEXPR left_type left() const
1243
+ {
1244
+ return left_type(arg1);
1245
+ }
1246
+ BOOST_MP_CXX14_CONSTEXPR left_middle_type left_middle() const { return left_middle_type(arg2); }
1247
+ BOOST_MP_CXX14_CONSTEXPR right_middle_type right_middle() const { return right_middle_type(arg3); }
1248
+ BOOST_MP_CXX14_CONSTEXPR right_type right() const { return right_type(arg4); }
1249
+ BOOST_MP_CXX14_CONSTEXPR const Arg1& left_ref() const noexcept { return arg1; }
1250
+ BOOST_MP_CXX14_CONSTEXPR const Arg2& left_middle_ref() const noexcept { return arg2; }
1251
+ BOOST_MP_CXX14_CONSTEXPR const Arg3& right_middle_ref() const noexcept { return arg3; }
1252
+ BOOST_MP_CXX14_CONSTEXPR const Arg4& right_ref() const noexcept { return arg4; }
1253
+
1254
+ template <class T
1255
+ #ifndef __SUNPRO_CC
1256
+ ,
1257
+ typename std::enable_if<!is_number<T>::value && !std::is_convertible<result_type, T const&>::value && std::is_constructible<T, result_type>::value, int>::type = 0
1258
+ #endif
1259
+ >
1260
+ explicit BOOST_MP_CXX14_CONSTEXPR operator T() const
1261
+ {
1262
+ return static_cast<T>(static_cast<result_type>(*this));
1263
+ }
1264
+ BOOST_MP_FORCEINLINE explicit BOOST_MP_CXX14_CONSTEXPR operator bool() const
1265
+ {
1266
+ result_type r(*this);
1267
+ return static_cast<bool>(r);
1268
+ }
1269
+ template <class T>
1270
+ BOOST_MP_CXX14_CONSTEXPR T convert_to()
1271
+ {
1272
+ result_type r(*this);
1273
+ return r.template convert_to<T>();
1274
+ }
1275
+
1276
+ static constexpr unsigned left_depth = left_type::depth + 1;
1277
+ static constexpr unsigned left_middle_depth = left_middle_type::depth + 1;
1278
+ static constexpr unsigned right_middle_depth = right_middle_type::depth + 1;
1279
+ static constexpr unsigned right_depth = right_type::depth + 1;
1280
+
1281
+ static constexpr unsigned left_max_depth = left_depth > left_middle_depth ? left_depth : left_middle_depth;
1282
+ static constexpr unsigned right_max_depth = right_depth > right_middle_depth ? right_depth : right_middle_depth;
1283
+
1284
+ static constexpr unsigned depth = left_max_depth > right_max_depth ? left_max_depth : right_max_depth;
1285
+
1286
+ private:
1287
+ typename expression_storage<Arg1>::type arg1;
1288
+ typename expression_storage<Arg2>::type arg2;
1289
+ typename expression_storage<Arg3>::type arg3;
1290
+ typename expression_storage<Arg4>::type arg4;
1291
+ expression& operator=(const expression&);
1292
+ };
1293
+
1294
+ template <class T>
1295
+ struct digits2
1296
+ {
1297
+ static_assert(std::numeric_limits<T>::is_specialized, "numeric_limits must be specialized here");
1298
+ static_assert((std::numeric_limits<T>::radix == 2) || (std::numeric_limits<T>::radix == 10), "Failed radix check");
1299
+ // If we really have so many digits that this fails, then we're probably going to hit other problems anyway:
1300
+ static_assert(LONG_MAX / 1000 > (std::numeric_limits<T>::digits + 1), "Too many digits to cope with here");
1301
+ static constexpr long m_value = std::numeric_limits<T>::radix == 10 ? (((std::numeric_limits<T>::digits + 1) * 1000L) / 301L) : std::numeric_limits<T>::digits;
1302
+ static inline constexpr long value() noexcept { return m_value; }
1303
+ };
1304
+
1305
+ #ifndef BOOST_MP_MIN_EXPONENT_DIGITS
1306
+ #ifdef _MSC_VER
1307
+ #define BOOST_MP_MIN_EXPONENT_DIGITS 2
1308
+ #else
1309
+ #define BOOST_MP_MIN_EXPONENT_DIGITS 2
1310
+ #endif
1311
+ #endif
1312
+
1313
+ template <class S>
1314
+ void format_float_string(S& str, std::intmax_t my_exp, std::intmax_t digits, std::ios_base::fmtflags f, bool iszero)
1315
+ {
1316
+ using size_type = typename S::size_type;
1317
+
1318
+ bool scientific = (f & std::ios_base::scientific) == std::ios_base::scientific;
1319
+ bool fixed = (f & std::ios_base::fixed) == std::ios_base::fixed;
1320
+ bool showpoint = (f & std::ios_base::showpoint) == std::ios_base::showpoint;
1321
+ bool showpos = (f & std::ios_base::showpos) == std::ios_base::showpos;
1322
+
1323
+ bool neg = str.size() && (str[0] == '-');
1324
+
1325
+ if (neg)
1326
+ str.erase(0, 1);
1327
+
1328
+ if (digits == 0 && !fixed)
1329
+ {
1330
+ digits = static_cast<std::intmax_t>((std::max)(str.size(), size_type(16)));
1331
+ }
1332
+
1333
+ if (iszero || str.empty() || (str.find_first_not_of('0') == S::npos))
1334
+ {
1335
+ // We will be printing zero, even though the value might not
1336
+ // actually be zero (it just may have been rounded to zero).
1337
+ str = "0";
1338
+ if (scientific || fixed)
1339
+ {
1340
+ if (showpoint || digits > 0) {
1341
+ str.append(1, '.');
1342
+ if (digits > 0)
1343
+ str.append(size_type(digits), '0');
1344
+ }
1345
+ if (scientific)
1346
+ str.append("e+00");
1347
+ }
1348
+ else
1349
+ {
1350
+ if (showpoint)
1351
+ {
1352
+ str.append(1, '.');
1353
+ if (digits > 1)
1354
+ str.append(size_type(digits - 1), '0');
1355
+ }
1356
+ }
1357
+ if (neg)
1358
+ str.insert(static_cast<std::string::size_type>(0), 1, '-');
1359
+ else if (showpos)
1360
+ str.insert(static_cast<std::string::size_type>(0), 1, '+');
1361
+ return;
1362
+ }
1363
+
1364
+ if (!fixed && !scientific && !showpoint)
1365
+ {
1366
+ //
1367
+ // Suppress trailing zeros:
1368
+ //
1369
+ std::string::iterator pos = str.end();
1370
+ while (pos != str.begin() && *--pos == '0')
1371
+ {
1372
+ }
1373
+ if (pos != str.end())
1374
+ ++pos;
1375
+ str.erase(pos, str.end());
1376
+ if (str.empty())
1377
+ str = '0';
1378
+ }
1379
+ else if (!fixed || (my_exp >= 0))
1380
+ {
1381
+ //
1382
+ // Pad out the end with zero's if we need to:
1383
+ //
1384
+ std::intmax_t chars = static_cast<std::intmax_t>(str.size());
1385
+ chars = digits - chars;
1386
+ if (scientific)
1387
+ ++chars;
1388
+ if (chars > 0)
1389
+ {
1390
+ str.append(static_cast<std::string::size_type>(chars), '0');
1391
+ }
1392
+ }
1393
+
1394
+ if (fixed || (!scientific && (my_exp >= -4) && (my_exp < digits)))
1395
+ {
1396
+ if (1 + my_exp > static_cast<std::intmax_t>(str.size()))
1397
+ {
1398
+ // Just pad out the end with zeros:
1399
+ str.append(static_cast<std::string::size_type>(1 + my_exp - static_cast<std::intmax_t>(str.size())), '0');
1400
+ if (showpoint || (fixed && digits > 0))
1401
+ str.append(".");
1402
+ }
1403
+ else if (my_exp + 1 < static_cast<std::intmax_t>(str.size()))
1404
+ {
1405
+ if (my_exp < 0)
1406
+ {
1407
+ str.insert(static_cast<std::string::size_type>(0), static_cast<std::string::size_type>(-1 - my_exp), '0');
1408
+ str.insert(static_cast<std::string::size_type>(0), "0.");
1409
+ }
1410
+ else
1411
+ {
1412
+ // Insert the decimal point:
1413
+ str.insert(static_cast<std::string::size_type>(my_exp + 1), 1, '.');
1414
+ }
1415
+ }
1416
+ else if (showpoint || (fixed && digits > 0)) // we have exactly the digits we require to left of the point
1417
+ str += ".";
1418
+
1419
+ if (fixed)
1420
+ {
1421
+ // We may need to add trailing zeros:
1422
+ auto pos = str.find('.');
1423
+ if (pos != str.npos) { // this test is probably redundant, but just to be safe and for clarity
1424
+ std::intmax_t l = static_cast<std::intmax_t>(pos + 1);
1425
+ l = static_cast<std::intmax_t>(digits - (static_cast<std::intmax_t>(str.size()) - l));
1426
+ if (l > 0)
1427
+ str.append(size_type(l), '0');
1428
+ }
1429
+ }
1430
+ }
1431
+ else
1432
+ {
1433
+ BOOST_MP_USING_ABS
1434
+ // Scientific format:
1435
+ if (showpoint || (str.size() > 1))
1436
+ str.insert(static_cast<std::string::size_type>(1u), 1, '.');
1437
+ str.append(static_cast<std::string::size_type>(1u), 'e');
1438
+
1439
+ S e;
1440
+
1441
+ #ifndef BOOST_MP_STANDALONE
1442
+ e = boost::lexical_cast<S>(abs(my_exp));
1443
+ #else
1444
+ BOOST_IF_CONSTEXPR(std::is_same<S, std::string>::value)
1445
+ {
1446
+ e = std::to_string(abs(my_exp));
1447
+ }
1448
+ else
1449
+ {
1450
+ const std::string str_local_exp = std::to_string(abs(my_exp));
1451
+ e = S(str_local_exp.cbegin(), str_local_exp.cend());
1452
+ }
1453
+ #endif
1454
+
1455
+ if (e.size() < BOOST_MP_MIN_EXPONENT_DIGITS)
1456
+ e.insert(static_cast<std::string::size_type>(0), BOOST_MP_MIN_EXPONENT_DIGITS - e.size(), '0');
1457
+ if (my_exp < 0)
1458
+ e.insert(static_cast<std::string::size_type>(0), 1, '-');
1459
+ else
1460
+ e.insert(static_cast<std::string::size_type>(0), 1, '+');
1461
+ str.append(e);
1462
+ }
1463
+ if (neg)
1464
+ str.insert(static_cast<std::string::size_type>(0), 1, '-');
1465
+ else if (showpos)
1466
+ str.insert(static_cast<std::string::size_type>(0), 1, '+');
1467
+ }
1468
+
1469
+ template <class V>
1470
+ BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const std::integral_constant<bool, true>&, const std::integral_constant<bool, true>&)
1471
+ {
1472
+ if (val > (std::numeric_limits<std::size_t>::max)())
1473
+ BOOST_MP_THROW_EXCEPTION(std::out_of_range("Can not shift by a value greater than std::numeric_limits<std::size_t>::max()."));
1474
+ if (val < 0)
1475
+ BOOST_MP_THROW_EXCEPTION(std::out_of_range("Can not shift by a negative value."));
1476
+ }
1477
+ template <class V>
1478
+ BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const std::integral_constant<bool, false>&, const std::integral_constant<bool, true>&)
1479
+ {
1480
+ if (val < 0)
1481
+ BOOST_MP_THROW_EXCEPTION(std::out_of_range("Can not shift by a negative value."));
1482
+ }
1483
+ template <class V>
1484
+ BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const std::integral_constant<bool, true>&, const std::integral_constant<bool, false>&)
1485
+ {
1486
+ if (val > (std::numeric_limits<std::size_t>::max)())
1487
+ BOOST_MP_THROW_EXCEPTION(std::out_of_range("Can not shift by a value greater than std::numeric_limits<std::size_t>::max()."));
1488
+ }
1489
+ template <class V>
1490
+ BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V, const std::integral_constant<bool, false>&, const std::integral_constant<bool, false>&) noexcept {}
1491
+
1492
+ template <class T>
1493
+ BOOST_MP_CXX14_CONSTEXPR const T& evaluate_if_expression(const T& val) { return val; }
1494
+ template <class T>
1495
+ BOOST_MP_CXX14_CONSTEXPR T&& evaluate_if_expression(T&& val) { return static_cast<T&&>(val); }
1496
+ template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
1497
+ BOOST_MP_CXX14_CONSTEXPR typename expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type evaluate_if_expression(const expression<tag, Arg1, Arg2, Arg3, Arg4>& val) { return val; }
1498
+ template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
1499
+ BOOST_MP_CXX14_CONSTEXPR typename expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type evaluate_if_expression(expression<tag, Arg1, Arg2, Arg3, Arg4>&& val) { return val; }
1500
+
1501
+ template <class T>
1502
+ struct convertible_to
1503
+ {
1504
+ operator T () const;
1505
+ };
1506
+
1507
+ } // namespace detail
1508
+
1509
+ //
1510
+ // Traits class, lets us know what kind of number we have, defaults to a floating point type:
1511
+ //
1512
+ enum number_category_type
1513
+ {
1514
+ number_kind_unknown = -1,
1515
+ number_kind_integer = 0,
1516
+ number_kind_floating_point = 1,
1517
+ number_kind_rational = 2,
1518
+ number_kind_fixed_point = 3,
1519
+ number_kind_complex = 4
1520
+ };
1521
+
1522
+ template <class Num, bool, bool>
1523
+ struct number_category_base : public std::integral_constant<int, number_kind_unknown>
1524
+ {};
1525
+ template <class Num>
1526
+ struct number_category_base<Num, true, false> : public std::integral_constant<int, std::numeric_limits<Num>::is_integer ? number_kind_integer : (std::numeric_limits<Num>::max_exponent ? number_kind_floating_point : number_kind_unknown)>
1527
+ {};
1528
+ template <class Num>
1529
+ struct number_category : public number_category_base<Num, std::is_class<Num>::value || boost::multiprecision::detail::is_arithmetic<Num>::value, std::is_abstract<Num>::value>
1530
+ {};
1531
+ template <class Backend, expression_template_option ExpressionTemplates>
1532
+ struct number_category<number<Backend, ExpressionTemplates> > : public number_category<Backend>
1533
+ {};
1534
+ template <class tag, class A1, class A2, class A3, class A4>
1535
+ struct number_category<detail::expression<tag, A1, A2, A3, A4> > : public number_category<typename detail::expression<tag, A1, A2, A3, A4>::result_type>
1536
+ {};
1537
+ //
1538
+ // Specializations for types which do not always have numberic_limits specializations:
1539
+ //
1540
+ #ifdef BOOST_HAS_INT128
1541
+ template <>
1542
+ struct number_category<boost::multiprecision::int128_type> : public std::integral_constant<int, number_kind_integer>
1543
+ {};
1544
+ template <>
1545
+ struct number_category<boost::multiprecision::uint128_type> : public std::integral_constant<int, number_kind_integer>
1546
+ {};
1547
+ #endif
1548
+ #ifdef BOOST_HAS_FLOAT128
1549
+ template <>
1550
+ struct number_category<boost::multiprecision::float128_type> : public std::integral_constant<int, number_kind_floating_point>
1551
+ {};
1552
+ #endif
1553
+
1554
+ template <class T>
1555
+ struct component_type
1556
+ {
1557
+ using type = T;
1558
+ };
1559
+ template <class tag, class A1, class A2, class A3, class A4>
1560
+ struct component_type<detail::expression<tag, A1, A2, A3, A4> > : public component_type<typename detail::expression<tag, A1, A2, A3, A4>::result_type>
1561
+ {};
1562
+
1563
+ template <class T>
1564
+ struct scalar_result_from_possible_complex
1565
+ {
1566
+ using type = typename std::conditional<number_category<T>::value == number_kind_complex, typename component_type<T>::type, T>::type;
1567
+ };
1568
+
1569
+ template <class T>
1570
+ struct complex_result_from_scalar; // individual backends must specialize this trait.
1571
+
1572
+ template <class T>
1573
+ struct is_unsigned_number : public std::integral_constant<bool, false>
1574
+ {};
1575
+ template <class Backend, expression_template_option ExpressionTemplates>
1576
+ struct is_unsigned_number<number<Backend, ExpressionTemplates> > : public is_unsigned_number<Backend>
1577
+ {};
1578
+ template <class T>
1579
+ struct is_signed_number : public std::integral_constant<bool, !is_unsigned_number<T>::value>
1580
+ {};
1581
+ template <class T>
1582
+ struct is_interval_number : public std::integral_constant<bool, false>
1583
+ {};
1584
+ template <class Backend, expression_template_option ExpressionTemplates>
1585
+ struct is_interval_number<number<Backend, ExpressionTemplates> > : public is_interval_number<Backend>
1586
+ {};
1587
+
1588
+ template <class T, class U>
1589
+ struct is_equivalent_number_type : public std::is_same<T, U>
1590
+ {};
1591
+
1592
+ template <class Backend, expression_template_option ExpressionTemplates, class T2>
1593
+ struct is_equivalent_number_type<number<Backend, ExpressionTemplates>, T2> : public is_equivalent_number_type<Backend, T2>
1594
+ {};
1595
+ template <class T1, class Backend, expression_template_option ExpressionTemplates>
1596
+ struct is_equivalent_number_type<T1, number<Backend, ExpressionTemplates> > : public is_equivalent_number_type<Backend, T1>
1597
+ {};
1598
+ template <class Backend, expression_template_option ExpressionTemplates, class Backend2, expression_template_option ExpressionTemplates2>
1599
+ struct is_equivalent_number_type<number<Backend, ExpressionTemplates>, number<Backend2, ExpressionTemplates2> > : public is_equivalent_number_type<Backend, Backend2>
1600
+ {};
1601
+
1602
+ }
1603
+ } // namespace boost
1604
+
1605
+ #ifdef BOOST_MP_MATH_AVAILABLE
1606
+ namespace boost { namespace math {
1607
+ namespace tools {
1608
+
1609
+ template <class T>
1610
+ struct promote_arg;
1611
+
1612
+ template <class tag, class A1, class A2, class A3, class A4>
1613
+ struct promote_arg<boost::multiprecision::detail::expression<tag, A1, A2, A3, A4> >
1614
+ {
1615
+ using type = typename boost::multiprecision::detail::expression<tag, A1, A2, A3, A4>::result_type;
1616
+ };
1617
+
1618
+ template <class R, class B, boost::multiprecision::expression_template_option ET>
1619
+ inline R real_cast(const boost::multiprecision::number<B, ET>& val)
1620
+ {
1621
+ return val.template convert_to<R>();
1622
+ }
1623
+
1624
+ template <class R, class tag, class A1, class A2, class A3, class A4>
1625
+ inline R real_cast(const boost::multiprecision::detail::expression<tag, A1, A2, A3, A4>& val)
1626
+ {
1627
+ using val_type = typename boost::multiprecision::detail::expression<tag, A1, A2, A3, A4>::result_type;
1628
+ return val_type(val).template convert_to<R>();
1629
+ }
1630
+
1631
+ template <class B, boost::multiprecision::expression_template_option ET>
1632
+ struct is_complex_type<boost::multiprecision::number<B, ET> > : public std::integral_constant<bool, boost::multiprecision::number_category<B>::value == boost::multiprecision::number_kind_complex> {};
1633
+
1634
+ } // namespace tools
1635
+
1636
+ namespace constants {
1637
+
1638
+ template <class T>
1639
+ struct is_explicitly_convertible_from_string;
1640
+
1641
+ template <class B, boost::multiprecision::expression_template_option ET>
1642
+ struct is_explicitly_convertible_from_string<boost::multiprecision::number<B, ET> >
1643
+ {
1644
+ static constexpr bool value = true;
1645
+ };
1646
+
1647
+ } // namespace constants
1648
+
1649
+ }} // namespace boost::math
1650
+ #endif
1651
+
1652
+ #ifdef BOOST_MSVC
1653
+ #pragma warning(pop)
1654
+ #endif
1655
+
1656
+ #endif // BOOST_MP_NUMBER_BASE_HPP