memory.pxd 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. from libcpp cimport bool, nullptr_t, nullptr
  2. cdef extern from "<memory>" namespace "std" nogil:
  3. cdef cppclass default_delete[T]:
  4. default_delete()
  5. cdef cppclass allocator[T]:
  6. allocator()
  7. allocator(const allocator &)
  8. #allocator(const allocator[U] &) #unique_ptr unit tests fail w/this
  9. T * address(T &)
  10. const T * address(const T &) const
  11. T * allocate( size_t n ) # Not to standard. should be a second default argument
  12. void deallocate(T * , size_t)
  13. size_t max_size() const
  14. void construct( T *, const T &) #C++98. The C++11 version is variadic AND perfect-forwarding
  15. void destroy(T *) #C++98
  16. void destroy[U](U *) #unique_ptr unit tests fail w/this
  17. cdef cppclass unique_ptr[T,DELETER=*]:
  18. unique_ptr()
  19. unique_ptr(nullptr_t)
  20. unique_ptr(T*)
  21. unique_ptr(unique_ptr[T]&)
  22. # Modifiers
  23. T* release()
  24. void reset()
  25. void reset(nullptr_t)
  26. void reset(T*)
  27. void swap(unique_ptr&)
  28. # Observers
  29. T* get()
  30. T& operator*()
  31. #T* operator->() # Not Supported
  32. bool operator bool()
  33. bool operator!()
  34. bool operator==(const unique_ptr&)
  35. bool operator!=(const unique_ptr&)
  36. bool operator<(const unique_ptr&)
  37. bool operator>(const unique_ptr&)
  38. bool operator<=(const unique_ptr&)
  39. bool operator>=(const unique_ptr&)
  40. bool operator==(nullptr_t)
  41. bool operator!=(nullptr_t)
  42. # Forward Declaration not working ("Compiler crash in AnalyseDeclarationsTransform")
  43. #cdef cppclass weak_ptr[T]
  44. cdef cppclass shared_ptr[T]:
  45. shared_ptr()
  46. shared_ptr(nullptr_t)
  47. shared_ptr(T*)
  48. shared_ptr(shared_ptr[T]&)
  49. shared_ptr(shared_ptr[T]&, T*)
  50. shared_ptr(unique_ptr[T]&)
  51. #shared_ptr(weak_ptr[T]&) # Not Supported
  52. # Modifiers
  53. void reset()
  54. void reset(T*)
  55. void swap(shared_ptr&)
  56. # Observers
  57. T* get()
  58. T& operator*()
  59. #T* operator->() # Not Supported
  60. long use_count()
  61. bool unique()
  62. bool operator bool()
  63. bool operator!()
  64. #bool owner_before[Y](const weak_ptr[Y]&) # Not Supported
  65. bool owner_before[Y](const shared_ptr[Y]&)
  66. bool operator==(const shared_ptr&)
  67. bool operator!=(const shared_ptr&)
  68. bool operator<(const shared_ptr&)
  69. bool operator>(const shared_ptr&)
  70. bool operator<=(const shared_ptr&)
  71. bool operator>=(const shared_ptr&)
  72. bool operator==(nullptr_t)
  73. bool operator!=(nullptr_t)
  74. cdef cppclass weak_ptr[T]:
  75. weak_ptr()
  76. weak_ptr(weak_ptr[T]&)
  77. weak_ptr(shared_ptr[T]&)
  78. # Modifiers
  79. void reset()
  80. void swap(weak_ptr&)
  81. # Observers
  82. long use_count()
  83. bool expired()
  84. shared_ptr[T] lock()
  85. bool owner_before[Y](const weak_ptr[Y]&)
  86. bool owner_before[Y](const shared_ptr[Y]&)
  87. # Smart pointer non-member operations
  88. shared_ptr[T] make_shared[T](...) except +
  89. # Temporaries used for exception handling break generated code
  90. unique_ptr[T] make_unique[T](...) # except +
  91. # No checking on the compatibility of T and U.
  92. cdef shared_ptr[T] static_pointer_cast[T, U](const shared_ptr[U]&)
  93. cdef shared_ptr[T] dynamic_pointer_cast[T, U](const shared_ptr[U]&)
  94. cdef shared_ptr[T] const_pointer_cast[T, U](const shared_ptr[U]&)
  95. cdef shared_ptr[T] reinterpret_pointer_cast[T, U](const shared_ptr[U]&)