9 #include <density/runtime_type.h> 10 #include <type_traits> 31 template <
typename TYPE>
struct cv_qual_of<const TYPE>
35 template <
typename TYPE>
struct cv_qual_of<volatile TYPE>
39 template <
typename TYPE>
struct cv_qual_of<const volatile TYPE>
59 return (static_cast<unsigned>(i_first) & ~static_cast<unsigned>(i_second)) == 0;
89 using type =
const TYPE;
93 using type =
volatile TYPE;
97 using type =
const volatile TYPE;
104 template <
typename TYPE, cv_qual CV>
using add_cv_qual_t =
typename add_cv_qual<TYPE, CV>::type;
106 template <
typename RUNTIME_TYPE = runtime_type<>, cv_qual = cv_qual::no_qual>
110 template <
typename RUNTIME_TYPE = runtime_type<>>
114 template <
typename RUNTIME_TYPE = runtime_type<>>
118 template <
typename RUNTIME_TYPE = runtime_type<>>
128 template <
typename RUNTIME_TYPE, cv_qual CV_QUAL>
144 template <
typename RUNTIME_TYPE, cv_qual CV_QUALIFIER>
class dynamic_reference
148 dynamic_reference() =
delete;
161 #ifdef DOXYGEN_DOC_GENERATION 162 template <
typename TARGET_TYPE>
165 typename TARGET_TYPE,
166 typename std::enable_if<
173 RUNTIME_TYPE::template make<typename
std::remove_cv<TARGET_TYPE>::type>(),
187 : m_address(i_target_address), m_type(i_target_type)
203 #ifdef DOXYGEN_DOC_GENERATION 204 template <cv_qual OTHER_CV>
208 typename std::enable_if<is_less_or_equal_cv_qualified(OTHER_CV, CV_QUALIFIER)>::type * =
212 : dynamic_reference(i_source.type(), i_source.address())
218 dynamic_reference & operator=(
const dynamic_reference & i_source) =
delete;
223 constexpr
const RUNTIME_TYPE &
type() const noexcept {
return m_type; }
238 template <
typename TYPE> constexpr
bool is() const noexcept
241 m_type.template is<TYPE>();
255 template <
typename TYPE>
258 assert(m_type.template is<TYPE>());
264 RUNTIME_TYPE
const m_type;
Definition: conc_function_queue.h:11
constexpr bool is() const noexcept
Definition: dynamic_reference.h:238
Definition: dynamic_reference.h:83
Definition: runtime_type.h:1061
cv_qual
Definition: dynamic_reference.h:15
constexpr dynamic_reference(const dynamic_reference< RUNTIME_TYPE, OTHER_CV > &i_source)
Definition: dynamic_reference.h:211
constexpr bool is_less_cv_qualified(cv_qual i_first, cv_qual i_second) noexcept
Definition: dynamic_reference.h:71
typename add_cv_qual< TYPE, CV >::type add_cv_qual_t
Definition: dynamic_reference.h:104
constexpr bool is_less_or_equal_cv_qualified(cv_qual i_first, cv_qual i_second) noexcept
Definition: dynamic_reference.h:57
constexpr const RUNTIME_TYPE & type() const noexcept
Definition: dynamic_reference.h:223
dynamic_reference(TARGET_TYPE &i_target_object)
Definition: dynamic_reference.h:171
constexpr add_cv_qual_t< void, CV_QUALIFIER > * address() const noexcept
Definition: dynamic_reference.h:229
constexpr dynamic_reference(const RUNTIME_TYPE &i_target_type, add_cv_qual_t< void, CV_QUALIFIER > *i_target_address)
Definition: dynamic_reference.h:185
Definition: dynamic_reference.h:27
Definition: dynamic_reference.h:107
Definition: dynamic_reference.h:125
DENSITY_CPP14_CONSTEXPR add_cv_qual_t< TYPE, CV_QUALIFIER > & as() const noexcept
Definition: dynamic_reference.h:256