29#include <seastar/util/modules.hh>
35SEASTAR_MODULE_EXPORT_BEGIN
51SEASTAR_MODULE_EXPORT_END
65requires requires (T ptr) {
68inline typename std::pointer_traits<std::remove_const_t<T>>::element_type* checked_ptr_do_get(T& ptr) {
76inline T* checked_ptr_do_get(T* ptr)
noexcept {
99template<
typename Ptr,
typename NullDerefAction = default_null_deref_action>
100requires std::is_default_constructible_v<NullDerefAction> &&
requires (NullDerefAction action) {
123 checked_ptr() noexcept(noexcept(Ptr(
nullptr))) = default;
125 checked_ptr(Ptr&& ptr)
noexcept(std::is_nothrow_move_constructible_v<Ptr>) : _ptr(std::move(ptr)) {}
126 checked_ptr(
const Ptr& p)
noexcept(std::is_nothrow_copy_constructible_v<Ptr>) : _ptr(p) {}
136 return internal::checked_ptr_do_get(_ptr);
174 explicit operator bool()
const {
return bool(_ptr); }
176 bool operator==(
const checked_ptr& other)
const {
return _ptr == other._ptr; }
177 bool operator!=(
const checked_ptr& other)
const {
return _ptr != other._ptr; }
182 return std::hash<Ptr>()(_ptr);
The exception thrown by a default_null_deref_action.
Definition: checked_ptr.hh:38
seastar::checked_ptr class is a wrapper class that may be used with any pointer type (smart like std:...
Definition: checked_ptr.hh:103
element_type & operator*()
Definition: checked_ptr.hh:162
element_type * pointer
Type of the pointer to the underlying element.
Definition: checked_ptr.hh:109
Ptr & operator->()
Definition: checked_ptr.hh:148
const element_type & operator*() const
Definition: checked_ptr.hh:155
size_t hash() const
Definition: checked_ptr.hh:181
const Ptr & operator->() const
Definition: checked_ptr.hh:141
typename std::pointer_traits< Ptr >::element_type element_type
Underlying element type.
Definition: checked_ptr.hh:106
pointer get() const
Definition: checked_ptr.hh:134
Seastar API namespace.
Definition: abort_on_ebadf.hh:26
Default not engaged seastar::checked_ptr dereferencing action (functor).
Definition: checked_ptr.hh:45
void operator()() const
Definition: checked_ptr.hh:47
size_t operator()(const seastar::checked_ptr< T > &p) const
Definition: checked_ptr.hh:198