12#ifndef ARCCORE_BASE_AUTOREF2_H
13#define ARCCORE_BASE_AUTOREF2_H
58 _changeValue(from.m_value);
62 : m_value(from.m_value)
64 from.m_value =
nullptr;
70 _changeValue(from.m_value);
77 m_value = from.m_value;
78 from.m_value =
nullptr;
85 _changeValue(new_value);
95 ARCCORE_CHECK_PTR(m_value);
102 ARCCORE_CHECK_PTR(m_value);
107 T*
get()
const {
return m_value; }
109 bool isNull()
const {
return !m_value; }
110 operator bool()
const {
return m_value; }
112 friend bool operator==(
const ThatClass& a,
const ThatClass& b)
114 return a.get() == b.get();
116 friend bool operator!=(
const ThatClass& a,
const ThatClass& b)
118 return a.get() != b.get();
130 void _removeRef() noexcept
133 m_value->removeRef();
136 void _changeValue(T* new_value)
138 if (m_value == new_value)
147 T* m_value =
nullptr;
Definitions and globals of Arccore.
ThatClass & operator=(ThatClass &&from) noexcept
Move operator.
AutoRef2(const ThatClass &from)
Constructs a reference referencing from.
AutoRef2()=default
Constructs an instance without a reference.
AutoRef2(ThatClass &&from) noexcept
Constructs a reference referencing from.
~AutoRef2()
Destructor. Decrements the reference counter of the pointed object.
ThatClass & operator=(const ThatClass &from)
Copy operator.
T * get() const
Returns the object referenced by the instance.
T & operator*() const
Returns the object referenced by the instance.
ThatClass & operator=(T *new_value)
Assigns the value new_value to the instance.
T * operator->() const
Returns the object referenced by the instance.
AutoRef2(T *t)
Constructs an instance referencing t.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --