Cython 3.2.0__cp39-abi3-win32.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.
- Cython/Build/BuildExecutable.py +169 -0
- Cython/Build/Cache.py +199 -0
- Cython/Build/Cythonize.py +350 -0
- Cython/Build/Dependencies.py +1314 -0
- Cython/Build/Distutils.py +1 -0
- Cython/Build/Inline.py +463 -0
- Cython/Build/IpythonMagic.py +560 -0
- Cython/Build/SharedModule.py +94 -0
- Cython/Build/Tests/TestCyCache.py +194 -0
- Cython/Build/Tests/TestCythonizeArgsParser.py +481 -0
- Cython/Build/Tests/TestDependencies.py +133 -0
- Cython/Build/Tests/TestInline.py +177 -0
- Cython/Build/Tests/TestIpythonMagic.py +287 -0
- Cython/Build/Tests/TestRecythonize.py +212 -0
- Cython/Build/Tests/TestStripLiterals.py +155 -0
- Cython/Build/Tests/__init__.py +1 -0
- Cython/Build/__init__.py +11 -0
- Cython/CodeWriter.py +815 -0
- Cython/Compiler/AnalysedTreeTransforms.py +97 -0
- Cython/Compiler/Annotate.py +328 -0
- Cython/Compiler/AutoDocTransforms.py +320 -0
- Cython/Compiler/Buffer.py +680 -0
- Cython/Compiler/Builtin.py +984 -0
- Cython/Compiler/CmdLine.py +263 -0
- Cython/Compiler/Code.pxd +149 -0
- Cython/Compiler/Code.py +3746 -0
- Cython/Compiler/Code.pyd +0 -0
- Cython/Compiler/CodeGeneration.py +33 -0
- Cython/Compiler/CythonScope.py +191 -0
- Cython/Compiler/Dataclass.py +864 -0
- Cython/Compiler/DebugFlags.py +24 -0
- Cython/Compiler/Errors.py +297 -0
- Cython/Compiler/ExprNodes.py +15562 -0
- Cython/Compiler/FlowControl.pxd +97 -0
- Cython/Compiler/FlowControl.py +1451 -0
- Cython/Compiler/FlowControl.pyd +0 -0
- Cython/Compiler/FusedNode.py +971 -0
- Cython/Compiler/FusedNode.pyd +0 -0
- Cython/Compiler/Future.py +16 -0
- Cython/Compiler/Interpreter.py +57 -0
- Cython/Compiler/Lexicon.py +421 -0
- Cython/Compiler/LineTable.py +114 -0
- Cython/Compiler/LineTable.pyd +0 -0
- Cython/Compiler/Main.py +857 -0
- Cython/Compiler/MatchCaseNodes.py +259 -0
- Cython/Compiler/MemoryView.py +905 -0
- Cython/Compiler/ModuleNode.py +4235 -0
- Cython/Compiler/Naming.py +363 -0
- Cython/Compiler/Nodes.py +10831 -0
- Cython/Compiler/Optimize.py +5288 -0
- Cython/Compiler/Options.py +843 -0
- Cython/Compiler/ParseTreeTransforms.pxd +78 -0
- Cython/Compiler/ParseTreeTransforms.py +4638 -0
- Cython/Compiler/Parsing.pxd +9 -0
- Cython/Compiler/Parsing.py +4775 -0
- Cython/Compiler/Parsing.pyd +0 -0
- Cython/Compiler/Pipeline.py +439 -0
- Cython/Compiler/PyrexTypes.py +5870 -0
- Cython/Compiler/Pythran.py +232 -0
- Cython/Compiler/Scanning.pxd +48 -0
- Cython/Compiler/Scanning.py +701 -0
- Cython/Compiler/Scanning.pyd +0 -0
- Cython/Compiler/StringEncoding.py +298 -0
- Cython/Compiler/Symtab.py +3073 -0
- Cython/Compiler/Tests/TestBuffer.py +105 -0
- Cython/Compiler/Tests/TestBuiltin.py +72 -0
- Cython/Compiler/Tests/TestCmdLine.py +586 -0
- Cython/Compiler/Tests/TestCode.py +144 -0
- Cython/Compiler/Tests/TestFlowControl.py +65 -0
- Cython/Compiler/Tests/TestGrammar.py +202 -0
- Cython/Compiler/Tests/TestMemView.py +71 -0
- Cython/Compiler/Tests/TestParseTreeTransforms.py +285 -0
- Cython/Compiler/Tests/TestScanning.py +134 -0
- Cython/Compiler/Tests/TestSignatureMatching.py +73 -0
- Cython/Compiler/Tests/TestStringEncoding.py +21 -0
- Cython/Compiler/Tests/TestTreeFragment.py +63 -0
- Cython/Compiler/Tests/TestTreePath.py +103 -0
- Cython/Compiler/Tests/TestTypes.py +75 -0
- Cython/Compiler/Tests/TestUtilityLoad.py +112 -0
- Cython/Compiler/Tests/TestVisitor.py +61 -0
- Cython/Compiler/Tests/Utils.py +36 -0
- Cython/Compiler/Tests/__init__.py +1 -0
- Cython/Compiler/TreeFragment.py +278 -0
- Cython/Compiler/TreePath.py +303 -0
- Cython/Compiler/TypeInference.py +591 -0
- Cython/Compiler/TypeSlots.py +1174 -0
- Cython/Compiler/UFuncs.py +311 -0
- Cython/Compiler/UtilNodes.py +389 -0
- Cython/Compiler/UtilityCode.py +344 -0
- Cython/Compiler/Version.py +8 -0
- Cython/Compiler/Visitor.pxd +53 -0
- Cython/Compiler/Visitor.py +861 -0
- Cython/Compiler/Visitor.pyd +0 -0
- Cython/Compiler/__init__.py +1 -0
- Cython/Coverage.py +448 -0
- Cython/Debugger/Cygdb.py +177 -0
- Cython/Debugger/DebugWriter.py +82 -0
- Cython/Debugger/Tests/TestLibCython.py +275 -0
- Cython/Debugger/Tests/__init__.py +1 -0
- Cython/Debugger/Tests/cfuncs.c +8 -0
- Cython/Debugger/Tests/codefile +49 -0
- Cython/Debugger/Tests/test_libcython_in_gdb.py +578 -0
- Cython/Debugger/Tests/test_libpython_in_gdb.py +90 -0
- Cython/Debugger/__init__.py +1 -0
- Cython/Debugger/libcython.py +1548 -0
- Cython/Debugger/libpython.py +2821 -0
- Cython/Debugging.py +20 -0
- Cython/Distutils/__init__.py +2 -0
- Cython/Distutils/build_ext.py +139 -0
- Cython/Distutils/extension.py +96 -0
- Cython/Distutils/old_build_ext.py +351 -0
- Cython/Includes/cpython/__init__.pxd +173 -0
- Cython/Includes/cpython/array.pxd +178 -0
- Cython/Includes/cpython/bool.pxd +37 -0
- Cython/Includes/cpython/buffer.pxd +112 -0
- Cython/Includes/cpython/bytearray.pxd +33 -0
- Cython/Includes/cpython/bytes.pxd +200 -0
- Cython/Includes/cpython/cellobject.pxd +35 -0
- Cython/Includes/cpython/ceval.pxd +8 -0
- Cython/Includes/cpython/codecs.pxd +121 -0
- Cython/Includes/cpython/complex.pxd +60 -0
- Cython/Includes/cpython/contextvars.pxd +145 -0
- Cython/Includes/cpython/conversion.pxd +36 -0
- Cython/Includes/cpython/datetime.pxd +395 -0
- Cython/Includes/cpython/descr.pxd +26 -0
- Cython/Includes/cpython/dict.pxd +187 -0
- Cython/Includes/cpython/exc.pxd +263 -0
- Cython/Includes/cpython/fileobject.pxd +57 -0
- Cython/Includes/cpython/float.pxd +47 -0
- Cython/Includes/cpython/function.pxd +65 -0
- Cython/Includes/cpython/genobject.pxd +25 -0
- Cython/Includes/cpython/getargs.pxd +12 -0
- Cython/Includes/cpython/instance.pxd +25 -0
- Cython/Includes/cpython/iterator.pxd +36 -0
- Cython/Includes/cpython/iterobject.pxd +24 -0
- Cython/Includes/cpython/list.pxd +92 -0
- Cython/Includes/cpython/long.pxd +149 -0
- Cython/Includes/cpython/longintrepr.pxd +14 -0
- Cython/Includes/cpython/mapping.pxd +63 -0
- Cython/Includes/cpython/marshal.pxd +66 -0
- Cython/Includes/cpython/mem.pxd +120 -0
- Cython/Includes/cpython/memoryview.pxd +50 -0
- Cython/Includes/cpython/method.pxd +49 -0
- Cython/Includes/cpython/module.pxd +208 -0
- Cython/Includes/cpython/number.pxd +258 -0
- Cython/Includes/cpython/object.pxd +433 -0
- Cython/Includes/cpython/pycapsule.pxd +143 -0
- Cython/Includes/cpython/pylifecycle.pxd +68 -0
- Cython/Includes/cpython/pyport.pxd +8 -0
- Cython/Includes/cpython/pystate.pxd +95 -0
- Cython/Includes/cpython/pythread.pxd +53 -0
- Cython/Includes/cpython/ref.pxd +141 -0
- Cython/Includes/cpython/sequence.pxd +134 -0
- Cython/Includes/cpython/set.pxd +119 -0
- Cython/Includes/cpython/slice.pxd +70 -0
- Cython/Includes/cpython/time.pxd +129 -0
- Cython/Includes/cpython/tuple.pxd +72 -0
- Cython/Includes/cpython/type.pxd +53 -0
- Cython/Includes/cpython/unicode.pxd +639 -0
- Cython/Includes/cpython/version.pxd +32 -0
- Cython/Includes/cpython/weakref.pxd +78 -0
- Cython/Includes/libc/__init__.pxd +1 -0
- Cython/Includes/libc/complex.pxd +35 -0
- Cython/Includes/libc/errno.pxd +127 -0
- Cython/Includes/libc/float.pxd +43 -0
- Cython/Includes/libc/limits.pxd +28 -0
- Cython/Includes/libc/locale.pxd +46 -0
- Cython/Includes/libc/math.pxd +209 -0
- Cython/Includes/libc/setjmp.pxd +10 -0
- Cython/Includes/libc/signal.pxd +64 -0
- Cython/Includes/libc/stddef.pxd +9 -0
- Cython/Includes/libc/stdint.pxd +105 -0
- Cython/Includes/libc/stdio.pxd +80 -0
- Cython/Includes/libc/stdlib.pxd +72 -0
- Cython/Includes/libc/string.pxd +50 -0
- Cython/Includes/libc/threads.pxd +234 -0
- Cython/Includes/libc/time.pxd +52 -0
- Cython/Includes/libcpp/__init__.pxd +4 -0
- Cython/Includes/libcpp/algorithm.pxd +320 -0
- Cython/Includes/libcpp/any.pxd +16 -0
- Cython/Includes/libcpp/atomic.pxd +59 -0
- Cython/Includes/libcpp/barrier.pxd +22 -0
- Cython/Includes/libcpp/bit.pxd +29 -0
- Cython/Includes/libcpp/cast.pxd +12 -0
- Cython/Includes/libcpp/cmath.pxd +518 -0
- Cython/Includes/libcpp/complex.pxd +106 -0
- Cython/Includes/libcpp/condition_variable.pxd +322 -0
- Cython/Includes/libcpp/deque.pxd +165 -0
- Cython/Includes/libcpp/exception.pxd +86 -0
- Cython/Includes/libcpp/execution.pxd +15 -0
- Cython/Includes/libcpp/forward_list.pxd +63 -0
- Cython/Includes/libcpp/functional.pxd +26 -0
- Cython/Includes/libcpp/future.pxd +103 -0
- Cython/Includes/libcpp/iterator.pxd +34 -0
- Cython/Includes/libcpp/latch.pxd +17 -0
- Cython/Includes/libcpp/limits.pxd +61 -0
- Cython/Includes/libcpp/list.pxd +117 -0
- Cython/Includes/libcpp/map.pxd +252 -0
- Cython/Includes/libcpp/memory.pxd +115 -0
- Cython/Includes/libcpp/mutex.pxd +387 -0
- Cython/Includes/libcpp/numbers.pxd +15 -0
- Cython/Includes/libcpp/numeric.pxd +131 -0
- Cython/Includes/libcpp/optional.pxd +34 -0
- Cython/Includes/libcpp/pair.pxd +1 -0
- Cython/Includes/libcpp/queue.pxd +25 -0
- Cython/Includes/libcpp/random.pxd +166 -0
- Cython/Includes/libcpp/semaphore.pxd +43 -0
- Cython/Includes/libcpp/set.pxd +228 -0
- Cython/Includes/libcpp/shared_mutex.pxd +96 -0
- Cython/Includes/libcpp/span.pxd +87 -0
- Cython/Includes/libcpp/stack.pxd +11 -0
- Cython/Includes/libcpp/stop_token.pxd +117 -0
- Cython/Includes/libcpp/string.pxd +355 -0
- Cython/Includes/libcpp/string_view.pxd +183 -0
- Cython/Includes/libcpp/typeindex.pxd +15 -0
- Cython/Includes/libcpp/typeinfo.pxd +10 -0
- Cython/Includes/libcpp/unordered_map.pxd +193 -0
- Cython/Includes/libcpp/unordered_set.pxd +152 -0
- Cython/Includes/libcpp/utility.pxd +30 -0
- Cython/Includes/libcpp/vector.pxd +186 -0
- Cython/Includes/numpy/math.pxd +150 -0
- Cython/Includes/openmp.pxd +50 -0
- Cython/Includes/posix/__init__.pxd +1 -0
- Cython/Includes/posix/dlfcn.pxd +14 -0
- Cython/Includes/posix/fcntl.pxd +86 -0
- Cython/Includes/posix/ioctl.pxd +4 -0
- Cython/Includes/posix/mman.pxd +101 -0
- Cython/Includes/posix/resource.pxd +57 -0
- Cython/Includes/posix/select.pxd +21 -0
- Cython/Includes/posix/signal.pxd +73 -0
- Cython/Includes/posix/stat.pxd +98 -0
- Cython/Includes/posix/stdio.pxd +37 -0
- Cython/Includes/posix/stdlib.pxd +29 -0
- Cython/Includes/posix/strings.pxd +9 -0
- Cython/Includes/posix/time.pxd +71 -0
- Cython/Includes/posix/types.pxd +30 -0
- Cython/Includes/posix/uio.pxd +26 -0
- Cython/Includes/posix/unistd.pxd +271 -0
- Cython/Includes/posix/wait.pxd +38 -0
- Cython/Plex/Actions.pxd +24 -0
- Cython/Plex/Actions.py +119 -0
- Cython/Plex/Actions.pyd +0 -0
- Cython/Plex/DFA.pxd +14 -0
- Cython/Plex/DFA.py +164 -0
- Cython/Plex/DFA.pyd +0 -0
- Cython/Plex/Errors.py +48 -0
- Cython/Plex/Lexicons.py +178 -0
- Cython/Plex/Machines.pxd +36 -0
- Cython/Plex/Machines.py +238 -0
- Cython/Plex/Machines.pyd +0 -0
- Cython/Plex/Regexps.py +535 -0
- Cython/Plex/Scanners.pxd +45 -0
- Cython/Plex/Scanners.py +328 -0
- Cython/Plex/Scanners.pyd +0 -0
- Cython/Plex/Transitions.pxd +14 -0
- Cython/Plex/Transitions.py +239 -0
- Cython/Plex/Transitions.pyd +0 -0
- Cython/Plex/__init__.py +34 -0
- Cython/Runtime/__init__.py +1 -0
- Cython/Runtime/refnanny.pyd +0 -0
- Cython/Runtime/refnanny.pyx +237 -0
- Cython/Shadow.py +690 -0
- Cython/Shadow.pyi +521 -0
- Cython/StringIOTree.py +170 -0
- Cython/StringIOTree.pyd +0 -0
- Cython/Tempita/__init__.py +4 -0
- Cython/Tempita/_looper.py +154 -0
- Cython/Tempita/_tempita.py +1091 -0
- Cython/Tempita/_tempita.pyd +0 -0
- Cython/TestUtils.py +422 -0
- Cython/Tests/TestCodeWriter.py +128 -0
- Cython/Tests/TestCythonUtils.py +202 -0
- Cython/Tests/TestJediTyper.py +223 -0
- Cython/Tests/TestShadow.py +114 -0
- Cython/Tests/TestStringIOTree.py +67 -0
- Cython/Tests/TestTestUtils.py +90 -0
- Cython/Tests/__init__.py +1 -0
- Cython/Tests/xmlrunner.py +390 -0
- Cython/Utility/AsyncGen.c +1031 -0
- Cython/Utility/Buffer.c +865 -0
- Cython/Utility/BufferFormatFromTypeInfo.pxd +2 -0
- Cython/Utility/Builtins.c +810 -0
- Cython/Utility/CConvert.pyx +134 -0
- Cython/Utility/CMath.c +104 -0
- Cython/Utility/CommonStructures.c +226 -0
- Cython/Utility/Complex.c +378 -0
- Cython/Utility/Coroutine.c +2300 -0
- Cython/Utility/CpdefEnums.pyx +103 -0
- Cython/Utility/CppConvert.pyx +282 -0
- Cython/Utility/CppSupport.cpp +151 -0
- Cython/Utility/CythonFunction.c +1832 -0
- Cython/Utility/Dataclasses.c +101 -0
- Cython/Utility/Embed.c +121 -0
- Cython/Utility/Exceptions.c +1016 -0
- Cython/Utility/ExtensionTypes.c +996 -0
- Cython/Utility/FunctionArguments.c +1043 -0
- Cython/Utility/FusedFunction.pyx +44 -0
- Cython/Utility/ImportExport.c +907 -0
- Cython/Utility/MemoryView.pxd +188 -0
- Cython/Utility/MemoryView.pyx +1482 -0
- Cython/Utility/MemoryView_C.c +927 -0
- Cython/Utility/ModuleSetupCode.c +3203 -0
- Cython/Utility/NumpyImportArray.c +46 -0
- Cython/Utility/ObjectHandling.c +3273 -0
- Cython/Utility/Optimize.c +1603 -0
- Cython/Utility/Overflow.c +384 -0
- Cython/Utility/Printing.c +86 -0
- Cython/Utility/Profile.c +732 -0
- Cython/Utility/StringTools.c +1379 -0
- Cython/Utility/Synchronization.c +399 -0
- Cython/Utility/TString.c +356 -0
- Cython/Utility/TestCyUtilityLoader.pyx +8 -0
- Cython/Utility/TestCythonScope.pyx +75 -0
- Cython/Utility/TestUtilityLoader.c +12 -0
- Cython/Utility/TypeConversion.c +1385 -0
- Cython/Utility/UFuncs.pyx +50 -0
- Cython/Utility/UFuncs_C.c +89 -0
- Cython/Utility/__init__.py +28 -0
- Cython/Utility/arrayarray.h +167 -0
- Cython/Utils.py +687 -0
- Cython/Utils.pyd +0 -0
- Cython/__init__.py +10 -0
- Cython/__init__.pyi +7 -0
- Cython/py.typed +0 -0
- cython-3.2.0.dist-info/METADATA +85 -0
- cython-3.2.0.dist-info/RECORD +333 -0
- cython-3.2.0.dist-info/WHEEL +5 -0
- cython-3.2.0.dist-info/entry_points.txt +4 -0
- cython-3.2.0.dist-info/top_level.txt +3 -0
- cython.py +29 -0
- pyximport/__init__.py +4 -0
- pyximport/pyxbuild.py +160 -0
- pyximport/pyximport.py +482 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
from libcpp cimport bool, nullptr_t, nullptr
|
|
2
|
+
|
|
3
|
+
cdef extern from "<memory>" namespace "std" nogil:
|
|
4
|
+
cdef cppclass default_delete[T]:
|
|
5
|
+
default_delete()
|
|
6
|
+
|
|
7
|
+
cdef cppclass allocator[T]:
|
|
8
|
+
allocator()
|
|
9
|
+
allocator(const allocator &)
|
|
10
|
+
#allocator(const allocator[U] &) #unique_ptr unit tests fail w/this
|
|
11
|
+
T * address(T &)
|
|
12
|
+
const T * address(const T &) const
|
|
13
|
+
T * allocate( size_t n ) # Not to standard. should be a second default argument
|
|
14
|
+
void deallocate(T * , size_t)
|
|
15
|
+
size_t max_size() const
|
|
16
|
+
void construct( T *, const T &) #C++98. The C++11 version is variadic AND perfect-forwarding
|
|
17
|
+
void destroy(T *) #C++98
|
|
18
|
+
void destroy[U](U *) #unique_ptr unit tests fail w/this
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
cdef cppclass unique_ptr[T,DELETER=*]:
|
|
22
|
+
unique_ptr()
|
|
23
|
+
unique_ptr(nullptr_t)
|
|
24
|
+
unique_ptr(T*)
|
|
25
|
+
unique_ptr(unique_ptr[T]&)
|
|
26
|
+
|
|
27
|
+
# Modifiers
|
|
28
|
+
T* release()
|
|
29
|
+
void reset()
|
|
30
|
+
void reset(nullptr_t)
|
|
31
|
+
void reset(T*)
|
|
32
|
+
void swap(unique_ptr&)
|
|
33
|
+
|
|
34
|
+
# Observers
|
|
35
|
+
T* get()
|
|
36
|
+
T& operator*()
|
|
37
|
+
#T* operator->() # Not Supported
|
|
38
|
+
bool operator bool()
|
|
39
|
+
bool operator!()
|
|
40
|
+
|
|
41
|
+
bool operator==(const unique_ptr&)
|
|
42
|
+
bool operator!=(const unique_ptr&)
|
|
43
|
+
bool operator<(const unique_ptr&)
|
|
44
|
+
bool operator>(const unique_ptr&)
|
|
45
|
+
bool operator<=(const unique_ptr&)
|
|
46
|
+
bool operator>=(const unique_ptr&)
|
|
47
|
+
|
|
48
|
+
bool operator==(nullptr_t)
|
|
49
|
+
bool operator!=(nullptr_t)
|
|
50
|
+
|
|
51
|
+
# Forward Declaration not working ("Compiler crash in AnalyseDeclarationsTransform")
|
|
52
|
+
#cdef cppclass weak_ptr[T]
|
|
53
|
+
|
|
54
|
+
cdef cppclass shared_ptr[T]:
|
|
55
|
+
shared_ptr()
|
|
56
|
+
shared_ptr(nullptr_t)
|
|
57
|
+
shared_ptr(T*)
|
|
58
|
+
shared_ptr(shared_ptr[T]&)
|
|
59
|
+
shared_ptr(shared_ptr[T]&, T*)
|
|
60
|
+
shared_ptr(unique_ptr[T]&)
|
|
61
|
+
#shared_ptr(weak_ptr[T]&) # Not Supported
|
|
62
|
+
shared_ptr[T]& operator=[Y](const shared_ptr[Y]& ptr)
|
|
63
|
+
|
|
64
|
+
# Modifiers
|
|
65
|
+
void reset()
|
|
66
|
+
void reset(T*)
|
|
67
|
+
void swap(shared_ptr&)
|
|
68
|
+
|
|
69
|
+
# Observers
|
|
70
|
+
T* get()
|
|
71
|
+
T& operator*()
|
|
72
|
+
#T* operator->() # Not Supported
|
|
73
|
+
long use_count()
|
|
74
|
+
bool unique()
|
|
75
|
+
bool operator bool()
|
|
76
|
+
bool operator!()
|
|
77
|
+
#bool owner_before[Y](const weak_ptr[Y]&) # Not Supported
|
|
78
|
+
bool owner_before[Y](const shared_ptr[Y]&)
|
|
79
|
+
|
|
80
|
+
bool operator==(const shared_ptr&)
|
|
81
|
+
bool operator!=(const shared_ptr&)
|
|
82
|
+
bool operator<(const shared_ptr&)
|
|
83
|
+
bool operator>(const shared_ptr&)
|
|
84
|
+
bool operator<=(const shared_ptr&)
|
|
85
|
+
bool operator>=(const shared_ptr&)
|
|
86
|
+
|
|
87
|
+
bool operator==(nullptr_t)
|
|
88
|
+
bool operator!=(nullptr_t)
|
|
89
|
+
|
|
90
|
+
cdef cppclass weak_ptr[T]:
|
|
91
|
+
weak_ptr()
|
|
92
|
+
weak_ptr(weak_ptr[T]&)
|
|
93
|
+
weak_ptr(shared_ptr[T]&)
|
|
94
|
+
|
|
95
|
+
# Modifiers
|
|
96
|
+
void reset()
|
|
97
|
+
void swap(weak_ptr&)
|
|
98
|
+
|
|
99
|
+
# Observers
|
|
100
|
+
long use_count()
|
|
101
|
+
bool expired()
|
|
102
|
+
shared_ptr[T] lock()
|
|
103
|
+
bool owner_before[Y](const weak_ptr[Y]&)
|
|
104
|
+
bool owner_before[Y](const shared_ptr[Y]&)
|
|
105
|
+
|
|
106
|
+
# Smart pointer non-member operations
|
|
107
|
+
shared_ptr[T] make_shared[T](...) except +
|
|
108
|
+
|
|
109
|
+
unique_ptr[T] make_unique[T](...) except +
|
|
110
|
+
|
|
111
|
+
# No checking on the compatibility of T and U.
|
|
112
|
+
cdef shared_ptr[T] static_pointer_cast[T, U](const shared_ptr[U]&)
|
|
113
|
+
cdef shared_ptr[T] dynamic_pointer_cast[T, U](const shared_ptr[U]&)
|
|
114
|
+
cdef shared_ptr[T] const_pointer_cast[T, U](const shared_ptr[U]&)
|
|
115
|
+
cdef shared_ptr[T] reinterpret_pointer_cast[T, U](const shared_ptr[U]&)
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
# cython: preliminary_late_includes_cy28=True
|
|
2
|
+
|
|
3
|
+
from libcpp cimport bool
|
|
4
|
+
|
|
5
|
+
cdef extern from "<mutex>" namespace "std" nogil:
|
|
6
|
+
# For all these mutex classes, we strongly recommend you do not use any
|
|
7
|
+
# blocking lock function while holding the GIL (try_lock should be fine though).
|
|
8
|
+
cppclass mutex:
|
|
9
|
+
# may not be present, and we know nothing about it
|
|
10
|
+
cppclass native_handle_type:
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
void lock() except+
|
|
14
|
+
bool try_lock()
|
|
15
|
+
void unlock()
|
|
16
|
+
|
|
17
|
+
native_handle_type native_handle() except+
|
|
18
|
+
|
|
19
|
+
cppclass timed_mutex:
|
|
20
|
+
# may not be present, and we know nothing about it
|
|
21
|
+
cppclass native_handle_type:
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
void lock() except+
|
|
25
|
+
bool try_lock()
|
|
26
|
+
bool try_lock_for[T](const T& duration) except+
|
|
27
|
+
bool try_lock_until[T](const T& time_point) except+
|
|
28
|
+
void unlock()
|
|
29
|
+
|
|
30
|
+
native_handle_type native_handle() except+
|
|
31
|
+
|
|
32
|
+
# We strongly recommend not mixing recursive_mutex and the GIL at all.
|
|
33
|
+
# Because "unlock" may not actually unlock it, it's pretty hard to reason about
|
|
34
|
+
# avoiding deadlocks.
|
|
35
|
+
cppclass recursive_mutex:
|
|
36
|
+
# may not be present, and we know nothing about it
|
|
37
|
+
cppclass native_handle_type:
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
void lock() except+
|
|
41
|
+
bool try_lock()
|
|
42
|
+
void unlock()
|
|
43
|
+
|
|
44
|
+
native_handle_type native_handle() except+
|
|
45
|
+
|
|
46
|
+
# We strongly recommend not mixing timed_recursive_mutex and the GIL at all.
|
|
47
|
+
# Because "unlock" may not actually unlock it, it's pretty hard to reason about
|
|
48
|
+
# avoiding deadlocks.
|
|
49
|
+
cppclass timed_recursive_mutex:
|
|
50
|
+
# may not be present, and we know nothing about it
|
|
51
|
+
cppclass native_handle_type:
|
|
52
|
+
pass
|
|
53
|
+
|
|
54
|
+
void lock() except+
|
|
55
|
+
bool try_lock()
|
|
56
|
+
bool try_lock_for[T](const T& duration) except+
|
|
57
|
+
bool try_lock_until[T](const T& time_point) except+
|
|
58
|
+
void unlock()
|
|
59
|
+
|
|
60
|
+
native_handle_type native_handle() except+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
# tags
|
|
64
|
+
cppclass defer_lock_t:
|
|
65
|
+
pass
|
|
66
|
+
defer_lock_t defer_lock
|
|
67
|
+
cppclass try_to_lock_t:
|
|
68
|
+
pass
|
|
69
|
+
try_to_lock_t try_to_lock
|
|
70
|
+
cppclass adopt_lock_t:
|
|
71
|
+
pass
|
|
72
|
+
adopt_lock_t adopt_lock
|
|
73
|
+
|
|
74
|
+
# lock_guard is probably unusable without cpp_locals because it
|
|
75
|
+
# can't be default-constructed or moved.
|
|
76
|
+
# We strongly recommend you do not use this while holding the GIL.
|
|
77
|
+
# A safe way to construct with the GIL is to lock the mutex with py_safe_lock
|
|
78
|
+
# and then construct the lock guard with adopt_lock_t.
|
|
79
|
+
cppclass lock_guard[T]:
|
|
80
|
+
ctypedef T mutex_type
|
|
81
|
+
lock_guard(mutex_type&) except+
|
|
82
|
+
lock_guard(mutex_type&, adopt_lock_t)
|
|
83
|
+
|
|
84
|
+
# We strongly recommend that you do not use any blocking lock function with the GIL.
|
|
85
|
+
# (try_lock is fine though).
|
|
86
|
+
cppclass unique_lock[T]:
|
|
87
|
+
ctypedef T mutex_type
|
|
88
|
+
unique_lock()
|
|
89
|
+
# This covers both the plain regular constructor, the 3 versions with tags
|
|
90
|
+
# and two std::chrono constructors. The two templated chrono versions stop
|
|
91
|
+
# us from declaring the overloads explicitly.
|
|
92
|
+
unique_lock(mutex_type&, ...) except+
|
|
93
|
+
#unique_lock(mutex_type&, defer_lock_t)
|
|
94
|
+
#unique_lock(mutex_type&, try_to_lock_t) except+
|
|
95
|
+
## this feels like it should be noexcet, but cppreference implies it isn't
|
|
96
|
+
#unique_lock(mutex_type&, adopt_lock_t) except+
|
|
97
|
+
|
|
98
|
+
void lock() except+
|
|
99
|
+
bool try_lock() except+
|
|
100
|
+
bool try_lock_for[T](const T& duration) except+
|
|
101
|
+
bool try_lock_until[T](const T& time_point) except+
|
|
102
|
+
void unlock() except+
|
|
103
|
+
|
|
104
|
+
void swap(unique_lock& other)
|
|
105
|
+
# "release" is definitely not the same as unlock. Noted here because
|
|
106
|
+
# DW always makes this mistake and regrets it and wants to save you
|
|
107
|
+
# from the same fate.
|
|
108
|
+
mutex_type* release()
|
|
109
|
+
|
|
110
|
+
mutex_type* mutex()
|
|
111
|
+
bool owns_lock()
|
|
112
|
+
bool operator bool()
|
|
113
|
+
|
|
114
|
+
# scoped lock is probably unusable without cpp_locals.
|
|
115
|
+
# It's also a variadic template type so can take potentially unlimited number of
|
|
116
|
+
# arguments. Cython doesn't support this, so if you want more than 26 arguments,
|
|
117
|
+
# you're on your own.
|
|
118
|
+
# We strongly recommend that you do not use this while holding the GIL.
|
|
119
|
+
# The safe way to use it when holding the GIL is to:
|
|
120
|
+
# 1. first lock the mutexes with py_safe_lock
|
|
121
|
+
# 2. construct scoped_lock with adopt_lock as the first argument
|
|
122
|
+
cppclass scoped_lock[A=*, B=*, C=*, D=*, E=*, F=*, G=*, H=*, I=*, J=*, K=*,
|
|
123
|
+
L=*, M=*, N=*, O=*, P=*, Q=*, R=*, S=*, T=*, U=*, V=*,
|
|
124
|
+
W=*, X=*, Y=*, Z=*]:
|
|
125
|
+
scoped_lock(...) except+
|
|
126
|
+
|
|
127
|
+
cppclass once_flag:
|
|
128
|
+
pass
|
|
129
|
+
|
|
130
|
+
bool try_lock(...) except+
|
|
131
|
+
# We strongly recommend that you do not call "lock" while holding the GIL.
|
|
132
|
+
# See py_safe_lock.
|
|
133
|
+
void lock(...) except+
|
|
134
|
+
|
|
135
|
+
# We can't enforce this in the interface, but you need to make sure that Callable
|
|
136
|
+
# doesn't require the GIL and doesn't throw Python exceptions.
|
|
137
|
+
# You should also not call this with the GIL held.
|
|
138
|
+
# We strong recommend using the py_safe_call_once wrappers below if you require the GIL.
|
|
139
|
+
void call_once[Callable](once_flag&, Callable& callable, ...) except +
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
cdef inline void _dummy_force_utility_code_inclusion() nogil:
|
|
143
|
+
with nogil:
|
|
144
|
+
pass
|
|
145
|
+
|
|
146
|
+
cdef extern from *:
|
|
147
|
+
# Treat this as a different type from Cython's point of view so that if users use our safe functions
|
|
148
|
+
# then they can't mix them with the unsafe functions using the same flag.
|
|
149
|
+
cdef cppclass py_safe_once_flag "std::once_flag":
|
|
150
|
+
pass
|
|
151
|
+
|
|
152
|
+
# Cython-specific wrappers to avoid deadlock.
|
|
153
|
+
# If you're holding the GIL then we strongly recommend you use these.
|
|
154
|
+
cdef extern from *:
|
|
155
|
+
"""
|
|
156
|
+
#include <utility>
|
|
157
|
+
#include <exception>
|
|
158
|
+
|
|
159
|
+
namespace {
|
|
160
|
+
|
|
161
|
+
static PyGILState_STATE __pyx_libcpp_mutex_limited_api_ensure_gil() {
|
|
162
|
+
#if CYTHON_COMPILING_IN_LIMITED_API
|
|
163
|
+
if ((__PYX_LIMITED_VERSION_HEX < 0x030d0000) && __Pyx_get_runtime_version() < 0x030d0000) {
|
|
164
|
+
return PyGILState_Ensure();
|
|
165
|
+
}
|
|
166
|
+
#endif
|
|
167
|
+
return PyGILState_LOCKED; // Unused
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
|
|
171
|
+
static void __pyx_libcpp_mutex_limited_api_release_gil(PyGILState_STATE gil_state) {
|
|
172
|
+
if (__Pyx_get_runtime_version() < 0x030d0000)
|
|
173
|
+
PyGILState_Release(gil_state);
|
|
174
|
+
}
|
|
175
|
+
#else
|
|
176
|
+
#define __pyx_libcpp_mutex_limited_api_release_gil(ignore) (void)ignore
|
|
177
|
+
#endif
|
|
178
|
+
|
|
179
|
+
static int __pyx_libcpp_mutex_has_gil() {
|
|
180
|
+
#if CYTHON_COMPILING_IN_LIMITED_API
|
|
181
|
+
if ((__PYX_LIMITED_VERSION_HEX >= 0x030d0000) || __Pyx_get_runtime_version() >= 0x030d0000) {
|
|
182
|
+
// In 3.13+ we can temporarily give up the GIL to find out what the thread state was
|
|
183
|
+
PyThreadState *ts = PyThreadState_Swap(NULL);
|
|
184
|
+
if (ts) {
|
|
185
|
+
PyThreadState_Swap(ts);
|
|
186
|
+
return 1;
|
|
187
|
+
}
|
|
188
|
+
return 0;
|
|
189
|
+
}
|
|
190
|
+
/* There is no way to know if we have the GIL. Therefore the only
|
|
191
|
+
* thing we can safely do is make absolutely sure that we have it
|
|
192
|
+
* in (__pyx_libcpp_mutex_limited_api_ensure_gil).
|
|
193
|
+
*/
|
|
194
|
+
return 1;
|
|
195
|
+
#elif PY_VERSION_HEX >= 0x030d0000
|
|
196
|
+
return PyThreadState_GetUnchecked() != NULL;
|
|
197
|
+
#elif PY_VERSION_HEX >= 0x030b0000
|
|
198
|
+
return _PyThreadState_UncheckedGet() != NULL;
|
|
199
|
+
#else
|
|
200
|
+
return PyGILState_Check();
|
|
201
|
+
#endif
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
template <typename F>
|
|
205
|
+
class __pyx_libcpp_mutex_cleanup_on_exit {
|
|
206
|
+
F on_exit;
|
|
207
|
+
bool invoke = true;
|
|
208
|
+
|
|
209
|
+
public:
|
|
210
|
+
explicit __pyx_libcpp_mutex_cleanup_on_exit(F f)
|
|
211
|
+
: on_exit(f)
|
|
212
|
+
{}
|
|
213
|
+
__pyx_libcpp_mutex_cleanup_on_exit(__pyx_libcpp_mutex_cleanup_on_exit &&rhs)
|
|
214
|
+
: on_exit(std::move(rhs.on_exit))
|
|
215
|
+
, invoke(rhs.invoke)
|
|
216
|
+
{
|
|
217
|
+
rhs.invoke = false;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
__pyx_libcpp_mutex_cleanup_on_exit(const __pyx_libcpp_mutex_cleanup_on_exit&) = delete;
|
|
221
|
+
__pyx_libcpp_mutex_cleanup_on_exit& operator=(const __pyx_libcpp_mutex_cleanup_on_exit&) = delete;
|
|
222
|
+
|
|
223
|
+
~__pyx_libcpp_mutex_cleanup_on_exit() {
|
|
224
|
+
if (invoke)
|
|
225
|
+
on_exit();
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
template<typename F>
|
|
230
|
+
__pyx_libcpp_mutex_cleanup_on_exit<F> __pyx_make_libcpp_mutex_cleanup_on_exit(F f) {
|
|
231
|
+
return __pyx_libcpp_mutex_cleanup_on_exit<F>(std::move(f));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
template <typename Callable, typename ... Args>
|
|
235
|
+
void __pyx_cpp_py_safe_call_once(std::once_flag& flag, Callable& callable, Args&&... args) {
|
|
236
|
+
class PyException : public std::exception {
|
|
237
|
+
public:
|
|
238
|
+
using std::exception::exception;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
__Pyx_UnknownThreadState thread_state = __Pyx_SaveUnknownThread();
|
|
242
|
+
auto on_exit = __pyx_make_libcpp_mutex_cleanup_on_exit(
|
|
243
|
+
[&]() {
|
|
244
|
+
__Pyx_RestoreUnknownThread(thread_state);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
try {
|
|
248
|
+
std::call_once(flag,
|
|
249
|
+
[&](Args& ...args) {
|
|
250
|
+
// Make sure we have the GIL
|
|
251
|
+
PyGILState_STATE gil_state;
|
|
252
|
+
int had_gil_on_call = __Pyx_UnknownThreadStateDefinitelyHadGil(thread_state);
|
|
253
|
+
if (had_gil_on_call) {
|
|
254
|
+
__Pyx_RestoreUnknownThread(thread_state);
|
|
255
|
+
} else {
|
|
256
|
+
gil_state = PyGILState_Ensure();
|
|
257
|
+
}
|
|
258
|
+
auto on_callable_exit = __pyx_make_libcpp_mutex_cleanup_on_exit(
|
|
259
|
+
[&]() {
|
|
260
|
+
if (had_gil_on_call) {
|
|
261
|
+
thread_state = __Pyx_SaveUnknownThread();
|
|
262
|
+
} else {
|
|
263
|
+
PyGILState_Release(gil_state);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
std::forward<Callable>(callable)(std::forward<Args>(args)...);
|
|
268
|
+
if (PyErr_Occurred()) {
|
|
269
|
+
throw PyException();
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
std::forward<Args>(args)...
|
|
273
|
+
);
|
|
274
|
+
} catch (const PyException&) {
|
|
275
|
+
// Do nothing
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
CYTHON_UNUSED void __pyx_cpp_py_safe_call_object_once(std::once_flag& flag, PyObject *py_callable) {
|
|
280
|
+
auto callable = [py_callable]() {
|
|
281
|
+
auto result = PyObject_CallObject(py_callable, nullptr);
|
|
282
|
+
Py_XDECREF(result);
|
|
283
|
+
};
|
|
284
|
+
__pyx_cpp_py_safe_call_once(flag, callable);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
template <typename LockableT>
|
|
288
|
+
void __pyx_std_lock_wrapper(LockableT& arg0) {
|
|
289
|
+
// std::lock only handles 2 or more arguments.
|
|
290
|
+
// So create a 1 argument version.
|
|
291
|
+
arg0.lock();
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
template <typename Lockable0T, typename Lockable1T, typename ... Lockables>
|
|
295
|
+
void __pyx_std_lock_wrapper(Lockable0T& arg0, Lockable1T& arg1, Lockables&... args) {
|
|
296
|
+
std::lock(arg0, arg1, args...);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
inline void __pyx_libcpp_mutex_unlock() {} // no-op
|
|
300
|
+
|
|
301
|
+
template <typename Lockable0T, typename ... Lockables>
|
|
302
|
+
void __pyx_libcpp_mutex_unlock(Lockable0T& arg0, Lockables&... locks) {
|
|
303
|
+
arg0.unlock();
|
|
304
|
+
__pyx_libcpp_mutex_unlock(locks...);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
template <typename LockableT>
|
|
308
|
+
int __pyx_std_try_lock_wrapper(LockableT& arg0) {
|
|
309
|
+
// std::try_lock only handles 2 or more arguments.
|
|
310
|
+
// So create a 1 argument version.
|
|
311
|
+
if (arg0.try_lock()) {
|
|
312
|
+
return -1;
|
|
313
|
+
}
|
|
314
|
+
return 0;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
template <typename Lockable0T, typename Lockable1T, typename ...Lockables>
|
|
318
|
+
int __pyx_std_try_lock_wrapper(Lockable0T& arg0, Lockable1T& arg1, Lockables&... args) {
|
|
319
|
+
return std::try_lock(arg0, arg1, args...);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
template <typename... LockTs>
|
|
323
|
+
void __pyx_py_safe_std_lock_release_lock_reacquire(LockTs& ...locks) {
|
|
324
|
+
// Release the GIL, acquire the lock, then reacquire the GIL.
|
|
325
|
+
// This is safe provided the user never holds the GIL while trying
|
|
326
|
+
// to reacquire the lock (i.e. it's safe provided they always use
|
|
327
|
+
// the py-safe wrappers).
|
|
328
|
+
PyThreadState *_save;
|
|
329
|
+
Py_UNBLOCK_THREADS
|
|
330
|
+
try {
|
|
331
|
+
__pyx_std_lock_wrapper(locks...);
|
|
332
|
+
} catch (...) {
|
|
333
|
+
// In this case, we probably can't reason about the state of the locks but we can at least
|
|
334
|
+
// make sure the GIL is consistent.
|
|
335
|
+
Py_BLOCK_THREADS
|
|
336
|
+
throw;
|
|
337
|
+
}
|
|
338
|
+
Py_BLOCK_THREADS
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
template <typename... LockTs>
|
|
343
|
+
void __pyx_py_safe_std_lock(LockTs& ...locks) {
|
|
344
|
+
PyGILState_STATE gil_state = __pyx_libcpp_mutex_limited_api_ensure_gil();
|
|
345
|
+
int had_gil_on_call = __pyx_libcpp_mutex_has_gil();
|
|
346
|
+
auto on_exit = __pyx_make_libcpp_mutex_cleanup_on_exit(
|
|
347
|
+
[&]() {
|
|
348
|
+
__pyx_libcpp_mutex_limited_api_release_gil(gil_state);
|
|
349
|
+
});
|
|
350
|
+
if (!had_gil_on_call) {
|
|
351
|
+
// Nothing special to do - just lock and quit
|
|
352
|
+
__pyx_std_lock_wrapper(locks...);
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// It's a real shame there's no try_lock for the GIL, otherwise
|
|
357
|
+
// we could just defer this whole thing to c++ std::lock.
|
|
358
|
+
if (__pyx_std_try_lock_wrapper(locks...) == -1) {
|
|
359
|
+
// success!
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
__pyx_py_safe_std_lock_release_lock_reacquire(locks...);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
template <typename MutexT>
|
|
366
|
+
std::unique_lock<MutexT> __pyx_py_safe_construct_unique_lock(MutexT& mutex) {
|
|
367
|
+
std::unique_lock<MutexT> l{mutex, std::defer_lock};
|
|
368
|
+
__pyx_py_safe_std_lock(l);
|
|
369
|
+
return l;
|
|
370
|
+
}
|
|
371
|
+
} // namespace
|
|
372
|
+
"""
|
|
373
|
+
# Call a Python callable once, ensuring that the GIL is released before locking, and the callable
|
|
374
|
+
# is called with the GIL held. The callable may be a Python object or C function.
|
|
375
|
+
# If using a generic callable, the callable can throw either Python
|
|
376
|
+
# or C++ exceptions. Both are treated like a C++ exception.
|
|
377
|
+
# The GIL state on exit is the same as on entry.
|
|
378
|
+
void py_safe_call_object_once "__pyx_cpp_py_safe_call_object_once" (py_safe_once_flag&, object callable) except +* nogil
|
|
379
|
+
void py_safe_call_once "__pyx_cpp_py_safe_call_once" [Callable](py_safe_once_flag&, Callable callable, ...) except +* nogil
|
|
380
|
+
|
|
381
|
+
# Call std::lock on the lockable objects with the GIL held, avoiding deadlock with the GIL.
|
|
382
|
+
# (Unlike the standard library version, it works with a single argument).
|
|
383
|
+
# The GIL state on exit is the same as on entry.
|
|
384
|
+
void py_safe_lock "__pyx_py_safe_std_lock" (...) except+ nogil
|
|
385
|
+
|
|
386
|
+
# construct a unique lock with the GIL held, avoiding deadlocks with the GIL
|
|
387
|
+
unique_lock[MutexT] py_safe_construct_unique_lock "__pyx_py_safe_construct_unique_lock" [MutexT](MutexT& m) except+ nogil
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
cdef extern from "<numbers>" namespace "std::numbers" nogil:
|
|
2
|
+
# C++20 mathematical constants
|
|
3
|
+
const double e
|
|
4
|
+
const double log2e
|
|
5
|
+
const double log10e
|
|
6
|
+
const double pi
|
|
7
|
+
const double inv_pi
|
|
8
|
+
const double inv_sqrtpi
|
|
9
|
+
const double ln2
|
|
10
|
+
const double ln10
|
|
11
|
+
const double sqrt2
|
|
12
|
+
const double sqrt3
|
|
13
|
+
const double inv_sqrt3
|
|
14
|
+
const double egamma
|
|
15
|
+
const double phi
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
cdef extern from "<numeric>" namespace "std" nogil:
|
|
2
|
+
T inner_product[InputIt1, InputIt2, T](InputIt1 first1, InputIt1 last1, InputIt2 first2, T init)
|
|
3
|
+
|
|
4
|
+
T inner_product[InputIt1, InputIt2, T, BinaryOperation1, BinaryOperation2](InputIt1 first1, InputIt1 last1,
|
|
5
|
+
InputIt2 first2, T init,
|
|
6
|
+
BinaryOperation1 op1,
|
|
7
|
+
BinaryOperation2 op2)
|
|
8
|
+
|
|
9
|
+
void iota[ForwardIt, T](ForwardIt first, ForwardIt last, T value)
|
|
10
|
+
|
|
11
|
+
T accumulate[InputIt, T](InputIt first, InputIt last, T init)
|
|
12
|
+
|
|
13
|
+
T accumulate[InputIt, T, BinaryOperation](InputIt first, InputIt last, T init, BinaryOperation op)
|
|
14
|
+
|
|
15
|
+
void adjacent_difference[InputIt, OutputIt](InputIt in_first, InputIt in_last, OutputIt out_first)
|
|
16
|
+
|
|
17
|
+
void adjacent_difference[InputIt, OutputIt, BinaryOperation](InputIt in_first, InputIt in_last, OutputIt out_first,
|
|
18
|
+
BinaryOperation op)
|
|
19
|
+
|
|
20
|
+
void partial_sum[InputIt, OutputIt](InputIt in_first, InputIt in_last, OutputIt out_first)
|
|
21
|
+
|
|
22
|
+
void partial_sum[InputIt, OutputIt, BinaryOperation](InputIt in_first, InputIt in_last, OutputIt out_first,
|
|
23
|
+
BinaryOperation op)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
T reduce[InputIt, T](InputIt first, InputIt last, T init)
|
|
27
|
+
|
|
28
|
+
# ambiguous with next overload
|
|
29
|
+
#T reduce[ExecutionPolicy, ForwardIt, T](ExecutionPolicy&& policy,
|
|
30
|
+
# ForwardIt first, ForwardIt last, T init)
|
|
31
|
+
|
|
32
|
+
T reduce[InputIt, T, BinaryOp](InputIt first, InputIt last, T init, BinaryOp binary_op)
|
|
33
|
+
|
|
34
|
+
T reduce[ExecutionPolicy, ForwardIt, T, BinaryOp](ExecutionPolicy&& policy,
|
|
35
|
+
ForwardIt first, ForwardIt last, T init, BinaryOp binary_op)
|
|
36
|
+
|
|
37
|
+
T transform_reduce[InputIt1, InputIt2, T](InputIt1 first1, InputIt1 last1,
|
|
38
|
+
InputIt2 first2, T init)
|
|
39
|
+
|
|
40
|
+
T transform_reduce[InputIt1, InputIt2, T, BinaryReductionOp, BinaryTransformOp](
|
|
41
|
+
InputIt1 first1, InputIt1 last1, InputIt2 first2, T init,
|
|
42
|
+
BinaryReductionOp reduce, BinaryTransformOp transform)
|
|
43
|
+
|
|
44
|
+
T transform_reduce[InputIt, T, BinaryReductionOp, UnaryTransformOp](
|
|
45
|
+
InputIt first, InputIt last, T init, BinaryReductionOp reduce,
|
|
46
|
+
UnaryTransformOp transform)
|
|
47
|
+
|
|
48
|
+
# ambiguous with previous overload
|
|
49
|
+
#T transform_reduce[ExecutionPolicy, ForwardIt1, ForwardIt2, T](
|
|
50
|
+
# ExecutionPolicy&& policy, ForwardIt1 first1, ForwardIt1 last1,
|
|
51
|
+
# ForwardIt2 first2, T init)
|
|
52
|
+
|
|
53
|
+
T transform_reduce[ExecutionPolicy, ForwardIt1, ForwardIt2, T, BinaryReductionOp, BinaryTransformOp](
|
|
54
|
+
ExecutionPolicy&& policy, ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2, T init,
|
|
55
|
+
BinaryReductionOp reduce, BinaryTransformOp transform)
|
|
56
|
+
|
|
57
|
+
# ambiguous with second overload
|
|
58
|
+
#T transform_reduce[ExecutionPolicy, ForwardIt, T, BinaryReductionOp, UnaryTransformOp](
|
|
59
|
+
# ExecutionPolicy&& policy, ForwardIt first, ForwardIt last, T init, BinaryReductionOp reduce,
|
|
60
|
+
# UnaryTransformOp transform)
|
|
61
|
+
|
|
62
|
+
OutputIt inclusive_scan[InputIt, OutputIt](InputIt first, InputIt last, OutputIt d_first)
|
|
63
|
+
|
|
64
|
+
# ambiguous with next overload
|
|
65
|
+
# ForwardIt2 inclusive_scan[ExecutionPolicy, ForwardIt1, ForwardIt2](
|
|
66
|
+
# ExecutionPolicy&& policy, ForwardIt1 first, ForwardIt1 last,
|
|
67
|
+
# ForwardIt2 d_first)
|
|
68
|
+
|
|
69
|
+
OutputIt inclusive_scan[InputIt, OutputIt, BinaryOperation](
|
|
70
|
+
InputIt first, InputIt last, OutputIt d_first, BinaryOperation binary_op)
|
|
71
|
+
|
|
72
|
+
# ambiguous with next overload
|
|
73
|
+
# ForwardIt2 inclusive_scan[ExecutionPolicy, ForwardIt1, ForwardIt2, BinaryOperation](
|
|
74
|
+
# ExecutionPolicy&& policy, ForwardIt1 first, ForwardIt1 last, ForwardIt2 d_first,
|
|
75
|
+
# BinaryOperation binary_op)
|
|
76
|
+
|
|
77
|
+
OutputIt inclusive_scan[InputIt, OutputIt, BinaryOperation, T](
|
|
78
|
+
InputIt first, InputIt last, OutputIt d_first, BinaryOperation binary_op,
|
|
79
|
+
T init)
|
|
80
|
+
|
|
81
|
+
#
|
|
82
|
+
# ForwardIt2 inclusive_scan[ExecutionPolicy, ForwardIt1, ForwardIt2, BinaryOperation, T](
|
|
83
|
+
# ExecutionPolicy&& policy, ForwardIt1 first, ForwardIt1 last, ForwardIt2 d_first,
|
|
84
|
+
# BinaryOperation binary_op, T init)
|
|
85
|
+
|
|
86
|
+
OutputIt exclusive_scan[InputIt, OutputIt, T](InputIt first, InputIt last,
|
|
87
|
+
OutputIt d_first, T init)
|
|
88
|
+
|
|
89
|
+
# ambiguous with next overload
|
|
90
|
+
#ForwardIt2 exclusive_scan[ExecutionPolicy, ForwardIt1, ForwardIt2, T](
|
|
91
|
+
# ExecutionPolicy&& policy, ForwardIt1 first, ForwardIt1 last,
|
|
92
|
+
# ForwardIt2 d_first, T init)
|
|
93
|
+
|
|
94
|
+
OutputIt exclusive_scan[InputIt, OutputIt, T, BinaryOperation](
|
|
95
|
+
InputIt first, InputIt last, OutputIt d_first, T init, BinaryOperation binary_op)
|
|
96
|
+
|
|
97
|
+
ForwardIt2 exclusive_scan[ExecutionPolicy, ForwardIt1, ForwardIt2, T, BinaryOperation](
|
|
98
|
+
ExecutionPolicy&& policy, ForwardIt1 first, ForwardIt1 last, ForwardIt2 d_first,
|
|
99
|
+
T init, BinaryOperation binary_op)
|
|
100
|
+
|
|
101
|
+
OutputIt transform_inclusive_scan[InputIt, OutputIt, BinaryOperation, UnaryOperation](
|
|
102
|
+
InputIt first, InputIt last, OutputIt d_first, BinaryOperation binary_op,
|
|
103
|
+
UnaryOperation unary_op)
|
|
104
|
+
|
|
105
|
+
# ambiguous with next overload
|
|
106
|
+
# ForwardIt2 transform_inclusive_scan[ExecutionPolicy, ForwardIt1, ForwardIt2, BinaryOperation, UnaryOperation](
|
|
107
|
+
# ExecutionPolicy&& policy, ForwardIt1 first, ForwardIt1 last, ForwardIt2 d_first,
|
|
108
|
+
# BinaryOperation binary_op, UnaryOperation unary_op)
|
|
109
|
+
|
|
110
|
+
OutputIt transform_inclusive_scan[InputIt, OutputIt, BinaryOperation, UnaryOperation, T](
|
|
111
|
+
InputIt first, InputIt last, OutputIt d_first, BinaryOperation binary_op,
|
|
112
|
+
UnaryOperation unary_op, T init)
|
|
113
|
+
|
|
114
|
+
ForwardIt2 transform_inclusive_scan[ExecutionPolicy, ForwardIt1, ForwardIt2, BinaryOperation, UnaryOperation, T](
|
|
115
|
+
ExecutionPolicy&& policy, ForwardIt1 first, ForwardIt1 last, ForwardIt2 d_first,
|
|
116
|
+
BinaryOperation binary_op, UnaryOperation unary_op, T init)
|
|
117
|
+
|
|
118
|
+
OutputIt transform_exclusive_scan[InputIt, OutputIt, T, BinaryOperation, UnaryOperation](
|
|
119
|
+
InputIt first, InputIt last, OutputIt d_first, T init, BinaryOperation binary_op,
|
|
120
|
+
UnaryOperation unary_op)
|
|
121
|
+
|
|
122
|
+
ForwardIt2 transform_exclusive_scan[ExecutionPolicy, ForwardIt1, ForwardIt2, T, BinaryOperation, UnaryOperation](
|
|
123
|
+
ExecutionPolicy&& policy, ForwardIt1 first, ForwardIt1 last, ForwardIt2 d_first,
|
|
124
|
+
T init, BinaryOperation binary_op, UnaryOperation unary_op)
|
|
125
|
+
|
|
126
|
+
# C++17
|
|
127
|
+
T gcd[T](T a, T b)
|
|
128
|
+
T lcm[T](T a, T b)
|
|
129
|
+
|
|
130
|
+
# C++20
|
|
131
|
+
T midpoint[T](T a, T b) except +
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from libcpp cimport bool
|
|
2
|
+
|
|
3
|
+
cdef extern from "<optional>" namespace "std" nogil:
|
|
4
|
+
cdef cppclass nullopt_t:
|
|
5
|
+
nullopt_t()
|
|
6
|
+
|
|
7
|
+
cdef nullopt_t nullopt
|
|
8
|
+
|
|
9
|
+
cdef cppclass optional[T]:
|
|
10
|
+
ctypedef T value_type
|
|
11
|
+
optional()
|
|
12
|
+
optional(nullopt_t)
|
|
13
|
+
optional(optional&) except +
|
|
14
|
+
optional(T&) except +
|
|
15
|
+
bool has_value()
|
|
16
|
+
T& value() except +
|
|
17
|
+
T& value_or[U](U& default_value)
|
|
18
|
+
void swap(optional&)
|
|
19
|
+
void reset()
|
|
20
|
+
T& emplace(...)
|
|
21
|
+
T& operator*()
|
|
22
|
+
#T* operator->() # Not Supported
|
|
23
|
+
optional& operator=(optional&)
|
|
24
|
+
optional& operator=[U](U&)
|
|
25
|
+
bool operator bool()
|
|
26
|
+
bool operator!()
|
|
27
|
+
bool operator==[U](optional&, U&)
|
|
28
|
+
bool operator!=[U](optional&, U&)
|
|
29
|
+
bool operator<[U](optional&, U&)
|
|
30
|
+
bool operator>[U](optional&, U&)
|
|
31
|
+
bool operator<=[U](optional&, U&)
|
|
32
|
+
bool operator>=[U](optional&, U&)
|
|
33
|
+
|
|
34
|
+
optional[T] make_optional[T](...) except +
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .utility cimport pair
|