11namespace Arp {
namespace Base {
namespace Core
29 using element_type =
typename std::pointer_traits<T>::element_type;
33 struct is_propagate_const : std::false_type
51 template <
class U,
class = std::enable_if_t < std::is_constructible_v < T, U && >>>
53 : t(
std::move(other.t))
59 template <
class U,
class = std::enable_if_t < std::is_constructible_v < T, U && > && !is_propagate_const<std::decay_t<U>>::value >>
61 : t(
std::forward<U>(other))
72 template<
class U,
class = std::enable_if_t<std::is_convertible_v<U, T>>>
75 this->t = std::move<U>(other.t);
81 template <
class U,
class = std::enable_if_t < std::is_convertible_v<U, T>&& !is_propagate_const<std::decay_t<U>>::value >>
84 this->t = std::forward<U>(other);
92 std::swap(this->t, other.t);
98 return GetPointer(this->t);
104 return GetPointer(this->t);
108 explicit operator bool()
const
110 return this->
get() !=
nullptr;
139 template <
class T_ = T,
class U = std::enable_if_t<std::is_convertible_v<const T_, const element_type*>>>
147 template <
class T_ = T,
class U = std::enable_if_t<std::is_convertible_v<const T_, const element_type*>>>
156 return lhs.t ==
nullptr;
162 return nullptr == rhs.t;
168 return lhs.t !=
nullptr;
174 return nullptr != rhs.t;
181 return lhs.t == rhs.t;
188 return lhs.t != rhs.t;
229 return GetPointer(u.get());
233 static constexpr const element_type* GetPointer(
const U* u)
239 static constexpr const element_type* GetPointer(
const U& u)
241 return GetPointer(u.get());
Encapsulates a (smart) pointer to ensure const-correctness even on pointer.
Definition: propagate_const.hxx:26
friend constexpr bool operator!=(std::nullptr_t, const propagate_const &rhs)
Equality comparison with nullptr
Definition: propagate_const.hxx:172
element_type * operator->()
Returns a raw pointer to the pointee
Definition: propagate_const.hxx:126
propagate_const & operator=(propagate_const< U > &&other)
Move assign from a propagate_const object of compatible type
Definition: propagate_const.hxx:73
void swap(propagate_const &other) noexcept
Swaps the contents of this and other
Definition: propagate_const.hxx:90
const element_type * operator->() const
Returns a const raw pointer to the pointee
Definition: propagate_const.hxx:132
friend constexpr bool operator!=(const propagate_const &lhs, std::nullptr_t)
Equality comparison with nullptr
Definition: propagate_const.hxx:166
friend constexpr bool operator==(const propagate_const &lhs, const propagate_const< U > &rhs)
Equality comparison with other propagate_const object
Definition: propagate_const.hxx:179
propagate_const & operator=(U &&other)
Assignment from an object of compatible type
Definition: propagate_const.hxx:82
propagate_const & operator=(propagate_const &&other) noexcept=default
Move assignment operator
element_type & operator*()
Returns a reference to the pointee
Definition: propagate_const.hxx:114
const element_type & operator*() const
Returns a const reference to the pointee
Definition: propagate_const.hxx:120
friend constexpr bool operator!=(const U &lhs, const propagate_const &rhs)
Equality comparison with underlying object type
Definition: propagate_const.hxx:214
friend constexpr bool operator==(std::nullptr_t, const propagate_const &rhs)
Equality comparison with nullptr
Definition: propagate_const.hxx:160
friend constexpr bool operator==(const propagate_const &lhs, const U &rhs)
Equality comparison with underlying object type
Definition: propagate_const.hxx:193
friend constexpr bool operator!=(const propagate_const &lhs, const U &rhs)
Equality comparison with underlying object type
Definition: propagate_const.hxx:200
propagate_const & operator=(const propagate_const &other)=delete
Copy assignment operator
friend constexpr bool operator!=(const propagate_const &lhs, const propagate_const< U > &rhs)
Equality comparison with other propagate_const object
Definition: propagate_const.hxx:186
constexpr propagate_const(propagate_const &&other) noexcept=default
Move constructor
constexpr propagate_const(U &&other)
Construct from an object of compatible type
Definition: propagate_const.hxx:60
propagate_const(const propagate_const &other)=delete
Copy constructor
constexpr propagate_const()=default
Creates object pointing to nullptr
element_type * get()
Returns a raw pointer to the pointee
Definition: propagate_const.hxx:96
typename std::pointer_traits< T >::element_type element_type
Type of the object pointed to by T
Definition: propagate_const.hxx:29
constexpr propagate_const(propagate_const< U > &&other)
Construct from a propagate_const object of compatible type
Definition: propagate_const.hxx:52
const element_type * get() const
Returns a const raw pointer to the pointee
Definition: propagate_const.hxx:102
friend constexpr bool operator==(const U &lhs, const propagate_const &rhs)
Equality comparison with underlying object type
Definition: propagate_const.hxx:207
friend constexpr bool operator==(const propagate_const &lhs, std::nullptr_t)
Equality comparison with nullptr
Definition: propagate_const.hxx:154
Root namespace for the PLCnext API
Namespace of the C++ standard library