Function proxy_typeid
// (1)
const std::type_info& proxy_typeid(const proxy_indirect_accessor<F>& operand) noexcept;
// (2)
const std::type_info& proxy_typeid(const proxy<F>& operand) noexcept;
Returns the typeid
of the contained type of proxy<F>
where F
is a facade type built from basic_facade_builder
.
(1)
Letp
beaccess_proxy
<F>(operand)
,ptr
be the contained value ofp
(if any). Returnstypeid(std::decay_t<decltype(*std::as_const(ptr))>)
ifp
contains a value, or otherwise,typeid(void)
.(2)
Letptr
be the contained value ofoperand
(if any). Returnstypeid(std::decay_t<decltype(ptr)>)
ifoperand
contains a valueptr
, or otherwise,typeid(void)
.
These functions are not visible to ordinary unqualified or qualified lookup. It can only be found by argument-dependent lookup when proxy_indirect_accessor<F>
(for rtti
or indirect_rtti
) or proxy<F>
(for direct_rtti
) is an associated class of the arguments.
Example
#include <iostream>
#include <proxy/proxy.h>
struct RttiAware : pro::facade_builder
::support<pro::skills::rtti>
::build {};
int main() {
pro::proxy<RttiAware> p;
std::cout << proxy_typeid(*p).name() << "\n"; // Prints "v" (assuming GCC)
p = pro::make_proxy<RttiAware>(123);
std::cout << proxy_typeid(*p).name() << "\n"; // Prints "i" (assuming GCC)
}