34 template <
typename T2>
46 template <
typename T2>
73 INLINE explicit operator bool()
const {
74 return ptr !=
nullptr;
81 template <
typename... TArgs>
82 INLINE decltype(
auto) operator()(TArgs&&... args)
const {
84 return (*ptr)(std::forward<TArgs>(args)...);
103 template <
typename T>
108 template <
typename T>
113 template <
typename T>
118 template <
typename T>
123 template <
typename T,
typename... TArgs>
125 return AutoPtr<T>(alignedNew<T>(std::forward<TArgs>(args)...));
132 template <
typename T1,
typename T2>
134 if (
RawPtr<T1> ptr = dynamicCast<T1>(source.get())) {
145 template <
typename T>
146 void swap(Sph::AutoPtr<T>& p1, Sph::AutoPtr<T>& p2) {
Base class for utility wrappers (Optional, Variant, ...)
INLINE void alignedDelete(T *ptr)
Deletes an object previously allocated using alignedNew.
#define SPH_ASSERT(x,...)
bool operator==(const AutoPtr< T > &ptr, std::nullptr_t)
INLINE AutoPtr< T > makeAuto(TArgs &&... args)
bool operator!=(const AutoPtr< T > &ptr, std::nullptr_t)
INLINE AutoPtr< T1 > dynamicCast(AutoPtr< T2 > &&source)
Performs a dynamic_cast on an AutoPtr, moving the ownership of the resource to the created object.
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
Simple non-owning wrapper of pointer.
Wrapper of pointer that deletes the resource from destructor.
INLINE void swap(AutoPtr &other)
INLINE bool operator!() const
INLINE AutoPtr(const AutoPtr &other)=delete
INLINE AutoPtr & operator=(AutoPtr< T2 > &&other)
INLINE T & operator*() const
INLINE T * operator->() const
INLINE AutoPtr & operator=(const AutoPtr &other)=delete
INLINE AutoPtr & operator=(std::nullptr_t)
INLINE AutoPtr(AutoPtr< T2 > &&other)
INLINE RawPtr< T > get() const
INLINE AutoPtr(std::nullptr_t)
Non-owning wrapper of pointer.
Overload of std::swap for Sph::Array.
void swap(Sph::Array< T, TCounter > &ar1, Sph::Array< T, TCounter > &ar2)