rttr::policy::prop Struct Reference

The prop class groups all policies that can be used during registration of properties. More...

#include <policy.h>

Static Public Attributes

static const detail::bind_as_ptr bind_as_ptr
 The bind_as_ptr policy will bind a member object as pointer type. More...
 

Detailed Description

The prop class groups all policies that can be used during registration of properties.

Member Data Documentation

const detail::bind_as_ptr rttr::policy::prop::bind_as_ptr
static

The bind_as_ptr policy will bind a member object as pointer type.

This can be useful when binding big data types, like arrays, to avoid copies during get/set of the property.

See following example code:

using namespace rttr;
struct Foo
{
std::vector<int> vec;
};
{
.property("vec", &Foo::vec)
(
);
}
int main()
{
Foo obj;
property prop = type::get<Foo>().get_property("vec");
variant var = prop.get_value(obj);
std::cout << var.is_type<std::vector<int>*>(); // prints "true"
prop.set_value(obj, var); // not really necessary, but remark that now a std::vector<int>* is expected
return 0;
}

The documentation for this struct was generated from the following file: