rttr Namespace Reference

Classes

class  argument
 The argument class is used for forwarding arguments to properties or methods. More...
 
class  array_range
 The array_range class provides a view into an underlying data structure with lower and upper limits. More...
 
struct  associative_container_mapper
 The associative_container_mapper class is a class template to access an associative container via one common interface. More...
 
class  basic_string_view
 The class template basic_string_view describes an non-owning reference to a constant contiguous sequence of char-like objects. More...
 
class  constructor
 The constructor class provides several meta information about a constructor and can be invoked. More...
 
class  destructor
 The destructor class provides a destructor for registered types. More...
 
class  enum_flags
 The enum_flags class template is used to store OR-combinations of enum values in a type-safe way. More...
 
class  enumeration
 The enumeration class provides several meta information about an enum. More...
 
class  instance
 The instance class is used for forwarding the instance of an object to invoke a property or method. More...
 
class  library
 The library class provides a cross platform way of explicit loading shared objects (.so on Unix based system and .DLL on windows). More...
 
class  method
 The method class provides several meta information about a method and can be invoked. More...
 
class  parameter_info
 The parameter_info class provides several meta information about a parameter. More...
 
struct  policy
 The policy class contains all policies that can be used during the registration of reflection information. More...
 
class  property
 The property class provides several meta information about a property and gives read/write access to its value. More...
 
class  registration
 The registration class is the entry point for the manual registration of reflection information to the type system. More...
 
struct  sequential_container_mapper
 The sequential_container_mapper class is a class template to access an associative container via one common interface. More...
 
class  type
 The type class holds the type information for any arbitrary object. More...
 
struct  type_list
 Contains a list of template parameters. More...
 
class  variant
 The variant class allows to store data of any type and convert between these types transparently. More...
 
class  variant_associative_view
 The variant_associative_view describes a class that refers to an associative container (e.g: std::map) inside a variant. More...
 
class  variant_sequential_view
 The variant_sequential_view describes a class that refers to an sequence container (e.g: std::vector) inside a variant. More...
 
class  visitor
 The class visitor, is used for visiting your registered accessors of a type at compile time. More...
 
struct  wrapper_mapper
 The wrapper_mapper class is a class template to access different wrapper types via one common interface. More...
 

Typedefs

using string_view = basic_string_view< char >
 A class to hold a reference to a continuous sequence of char objects. More...
 

Enumerations

enum  access_levels { access_levels::public_access, access_levels::protected_access, access_levels::private_access }
 The access_levels enum represents the three access modifiers, which can be used in classes to encapsulate members access. More...
 
enum  filter_item {
  filter_item::instance_item = 1, filter_item::static_item = 2, filter_item::public_access = 4, filter_item::non_public_access = 8,
  filter_item::declared_only = 16
}
 The filter_item enum is used to filter the search for certain members in types. More...
 

Functions

template<typename... TArgs>
detail::default_args< TArgs... > default_arguments (TArgs &&...args)
 The default_arguments function should be used add default arguments, for constructors or a methods during the registration process of reflection information. More...
 
detail::metadata metadata (variant key, variant value)
 The metadata function can be used to add additional meta data information during the registration process of reflection information. More...
 
template<typename CharT , typename Traits >
constexpr bool operator!= (basic_string_view< CharT, Traits > lhs, basic_string_view< CharT, Traits > rhs) noexcept
 Compares the two views lhs and rhs. More...
 
template<typename CharT , typename Traits >
constexpr bool operator!= (const char *lhs, basic_string_view< CharT, Traits > rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator!= (basic_string_view< CharT, Traits > lhs, const char *rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator!= (const std::basic_string< CharT, Traits > &lhs, basic_string_view< CharT, Traits > rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator!= (basic_string_view< CharT, Traits > lhs, const std::basic_string< CharT, Traits > &rhs) noexcept
 
template<typename CharT , typename Traits >
std::basic_string< CharT, Traits > operator+ (basic_string_view< CharT, Traits > lhs, const std::basic_string< CharT, Traits > &rhs)
 
template<typename CharT , typename Traits >
std::basic_string< CharT, Traits > operator+ (const std::basic_string< CharT, Traits > &lhs, basic_string_view< CharT, Traits > rhs)
 
template<typename CharT , typename Traits >
std::basic_string< CharT, Traits > operator+ (basic_string_view< CharT, Traits > lhs, std::basic_string< CharT, Traits > &&rhs)
 
template<typename CharT , typename Traits >
std::basic_string< CharT, Traits > operator+ (std::basic_string< CharT, Traits > &&lhs, basic_string_view< CharT, Traits > rhs)
 
template<typename CharT , typename Traits >
constexpr bool operator< (basic_string_view< CharT, Traits > lhs, basic_string_view< CharT, Traits > rhs) noexcept
 Compares the two views lhs and rhs. More...
 
template<typename CharT , typename Traits >
constexpr bool operator< (const char *lhs, basic_string_view< CharT, Traits > rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator< (basic_string_view< CharT, Traits > lhs, const char *rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator< (const std::basic_string< CharT, Traits > &lhs, basic_string_view< CharT, Traits > rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator< (basic_string_view< CharT, Traits > lhs, const std::basic_string< CharT, Traits > &rhs) noexcept
 
template<typename CharT , typename Traits >
std::basic_ostream< CharT, Traits > & operator<< (std::basic_ostream< CharT, Traits > &os, basic_string_view< CharT, Traits > v)
 Performs a stream output on a basic_string_view . More...
 
template<typename CharT , typename Traits >
constexpr bool operator<= (basic_string_view< CharT, Traits > lhs, basic_string_view< CharT, Traits > rhs) noexcept
 Compares the two views lhs and rhs. More...
 
template<typename CharT , typename Traits >
constexpr bool operator<= (const char *lhs, basic_string_view< CharT, Traits > rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator<= (basic_string_view< CharT, Traits > lhs, const char *rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator<= (const std::basic_string< CharT, Traits > &lhs, basic_string_view< CharT, Traits > rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator<= (basic_string_view< CharT, Traits > lhs, const std::basic_string< CharT, Traits > &rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator== (basic_string_view< CharT, Traits > lhs, basic_string_view< CharT, Traits > rhs) noexcept
 Compares the two views lhs and rhs. More...
 
template<typename CharT , typename Traits >
constexpr bool operator== (const char *lhs, basic_string_view< CharT, Traits > rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator== (basic_string_view< CharT, Traits > lhs, const char *rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator== (const std::basic_string< CharT, Traits > &lhs, basic_string_view< CharT, Traits > rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator== (basic_string_view< CharT, Traits > lhs, const std::basic_string< CharT, Traits > &rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator> (basic_string_view< CharT, Traits > lhs, basic_string_view< CharT, Traits > rhs) noexcept
 Compares the two views lhs and rhs. More...
 
template<typename CharT , typename Traits >
constexpr bool operator> (const char *lhs, basic_string_view< CharT, Traits > rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator> (basic_string_view< CharT, Traits > lhs, const char *rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator> (const std::basic_string< CharT, Traits > &lhs, basic_string_view< CharT, Traits > rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator> (basic_string_view< CharT, Traits > lhs, const std::basic_string< CharT, Traits > &rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator>= (basic_string_view< CharT, Traits > lhs, basic_string_view< CharT, Traits > rhs) noexcept
 Compares the two views lhs and rhs. More...
 
template<typename CharT , typename Traits >
constexpr bool operator>= (const char *lhs, basic_string_view< CharT, Traits > rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator>= (basic_string_view< CharT, Traits > lhs, const char *rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator>= (const std::basic_string< CharT, Traits > &lhs, basic_string_view< CharT, Traits > rhs) noexcept
 
template<typename CharT , typename Traits >
constexpr bool operator>= (basic_string_view< CharT, Traits > lhs, const std::basic_string< CharT, Traits > &rhs) noexcept
 
template<typename... TArgs>
detail::parameter_names< detail::decay_t< TArgs >... > parameter_names (TArgs &&...args)
 The parameter_names function should be used add human-readable names of the parameters, for constructors or a methods during the registration process of reflection information. More...
 
template<typename Target_Type , typename Source_Type >
Target_Type rttr_cast (Source_Type object) noexcept
 Casts the given object of type Source_Type to an object of type Target_Type. More...
 
template<typename ClassType , typename ReturnType , typename... Args>
auto select_const (ReturnType(ClassType::*func)(Args...) const) -> decltype(func)
 This is a helper function to register overloaded const member functions. More...
 
template<typename ClassType , typename ReturnType , typename... Args>
auto select_const (ReturnType(ClassType::*func)(Args...) const noexcept) -> decltype(func)
 Overload with noexcept function type. More...
 
template<typename ClassType , typename ReturnType , typename... Args>
auto select_non_const (ReturnType(ClassType::*func)(Args...)) -> decltype(func)
 This is a helper function to register overloaded const member functions. More...
 
template<typename ClassType , typename ReturnType , typename... Args>
auto select_non_const (ReturnType(ClassType::*func)(Args...) noexcept) -> decltype(func)
 Overload with noexcept function type. More...
 
template<typename Signature >
Signature * select_overload (Signature *func)
 This is a helper function to register overloaded functions. More...
 
template<typename Signature , typename ClassType >
auto select_overload (Signature(ClassType::*func)) -> decltype(func)
 This is a helper function to register overloaded member functions. More...
 
template<typename Enum_Type >
detail::enum_data< Enum_Type > value (string_view, Enum_Type value)
 The value function should be used to add a mapping from enum name to value during the registration process of reflection information. More...
 
template<class T >
variant_cast (const variant &operand)
 Returns a reference to the containing value as type T. More...
 
template<class T >
variant_cast (variant &operand)
 Returns a reference to the containing value as type T. More...
 
template<class T >
variant_cast (variant &&operand)
 Move the containing value from the variant into a type T. More...
 
template<class T >
const T * variant_cast (const variant *operand) noexcept
 Returns a pointer to the containing value with type T. More...
 
template<class T >
T * variant_cast (variant *operand) noexcept
 Returns a pointer to the containing value with type T. More...
 

Typedef Documentation

using rttr::string_view = typedef basic_string_view<char>

A class to hold a reference to a continuous sequence of char objects.

Enumeration Type Documentation

enum rttr::access_levels
strong

The access_levels enum represents the three access modifiers, which can be used in classes to encapsulate members access.

In contrast to the three static type values in the registration class, represents this enum the return value to retrieve the access level at runtime.

See also
method::get_access_level(), property::get_access_level(), constructor::get_access_level()
Enumerator
public_access 

Declares that this member was registered with public access.

protected_access 

Declares that this member was registered with protected access.

private_access 

Declares that this member was registered with private access.

enum rttr::filter_item
strong

The filter_item enum is used to filter the search for certain members in types.

Combine the enum value together with the bitwise OR operator.

Remarks
In order to get a return, you must specify filter_item::instance_item or filter_item::static_item along with an accessor filter_item::public_access or filter_item::non_public_access.
See also
type::get_properties(filter_items) const
Enumerator
instance_item 

Includes all members in the search, which needs an instance to be invoked.

static_item 

Includes all static members in the search.

Static members doesn't need any instance for invoking.

public_access 

Includes all public specified members in the search.

See also
access_levels
non_public_access 

Includes all non public (private or protected) members in the search.

See also
access_levels
declared_only 

Returns all members declared for the current type; inherited members are not returned.

Function Documentation

template<typename... TArgs>
detail::default_args<TArgs...> rttr::default_arguments ( TArgs &&...  args)

The default_arguments function should be used add default arguments, for constructors or a methods during the registration process of reflection information.

Use it in the () operator of the returned bind object.

The given arguments must match the signature from the starting position to the right most argument.

See following example code:

void my_function(int a, bool b, const std::string& text);
{
using namespace rttr;
registration::method("my_function", &my_function)
(
default_arguments(true, std::string("default text"))
);
// however setting default arguments like this, will raise a compile time error
registration::method("my_function2", &my_function)
(
default_arguments(true) // does not work!!!; default value for the last argument is missing...
);
}
detail::metadata rttr::metadata ( variant  key,
variant  value 
)

The metadata function can be used to add additional meta data information during the registration process of reflection information.

Use it in the () operator of the returned bind object.

template<typename CharT , typename Traits >
constexpr bool rttr::operator!= ( basic_string_view< CharT, Traits >  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept

Compares the two views lhs and rhs.

Two views are not equal if the size() differ or the characters of lhs are not equivalent and in the same position in rhs.

Returns
true when both views are not the same, otherwise false.
template<typename CharT , typename Traits >
constexpr bool rttr::operator!= ( const char *  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator!= ( basic_string_view< CharT, Traits >  lhs,
const char *  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator!= ( const std::basic_string< CharT, Traits > &  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator!= ( basic_string_view< CharT, Traits >  lhs,
const std::basic_string< CharT, Traits > &  rhs 
)
noexcept
template<typename CharT , typename Traits >
std::basic_string<CharT, Traits> rttr::operator+ ( basic_string_view< CharT, Traits >  lhs,
const std::basic_string< CharT, Traits > &  rhs 
)
template<typename CharT , typename Traits >
std::basic_string<CharT, Traits> rttr::operator+ ( const std::basic_string< CharT, Traits > &  lhs,
basic_string_view< CharT, Traits >  rhs 
)
template<typename CharT , typename Traits >
std::basic_string<CharT, Traits> rttr::operator+ ( basic_string_view< CharT, Traits >  lhs,
std::basic_string< CharT, Traits > &&  rhs 
)
template<typename CharT , typename Traits >
std::basic_string<CharT, Traits> rttr::operator+ ( std::basic_string< CharT, Traits > &&  lhs,
basic_string_view< CharT, Traits >  rhs 
)
template<typename CharT , typename Traits >
constexpr bool rttr::operator< ( basic_string_view< CharT, Traits >  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept

Compares the two views lhs and rhs.

The ordering comparisons is done lexicographically. The comparison is performed by a function equivalent to std::lexicographical_compare.

Returns
true when lhs is smaller than rhs, otherwise false.
template<typename CharT , typename Traits >
constexpr bool rttr::operator< ( const char *  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator< ( basic_string_view< CharT, Traits >  lhs,
const char *  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator< ( const std::basic_string< CharT, Traits > &  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator< ( basic_string_view< CharT, Traits >  lhs,
const std::basic_string< CharT, Traits > &  rhs 
)
noexcept
template<typename CharT , typename Traits >
std::basic_ostream<CharT, Traits>& rttr::operator<< ( std::basic_ostream< CharT, Traits > &  os,
basic_string_view< CharT, Traits >  v 
)

Performs a stream output on a basic_string_view .

Returns
os
template<typename CharT , typename Traits >
constexpr bool rttr::operator<= ( basic_string_view< CharT, Traits >  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept

Compares the two views lhs and rhs.

The ordering comparisons is done lexicographically. The comparison is performed by a function equivalent to std::lexicographical_compare.

Returns
true when lhs is smaller or equal to rhs, otherwise false.
template<typename CharT , typename Traits >
constexpr bool rttr::operator<= ( const char *  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator<= ( basic_string_view< CharT, Traits >  lhs,
const char *  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator<= ( const std::basic_string< CharT, Traits > &  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator<= ( basic_string_view< CharT, Traits >  lhs,
const std::basic_string< CharT, Traits > &  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator== ( basic_string_view< CharT, Traits >  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept

Compares the two views lhs and rhs.

Two views are equal if both the size() of lhs and rhs are equal and each character in lhs has an equivalent character in rhs at the same position.

Returns
true when both views are the same, otherwise false.
template<typename CharT , typename Traits >
constexpr bool rttr::operator== ( const char *  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator== ( basic_string_view< CharT, Traits >  lhs,
const char *  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator== ( const std::basic_string< CharT, Traits > &  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator== ( basic_string_view< CharT, Traits >  lhs,
const std::basic_string< CharT, Traits > &  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator> ( basic_string_view< CharT, Traits >  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept

Compares the two views lhs and rhs.

The ordering comparisons is done lexicographically. The comparison is performed by a function equivalent to std::lexicographical_compare.

Returns
true when lhs is greater than rhs, otherwise false.
template<typename CharT , typename Traits >
constexpr bool rttr::operator> ( const char *  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator> ( basic_string_view< CharT, Traits >  lhs,
const char *  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator> ( const std::basic_string< CharT, Traits > &  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator> ( basic_string_view< CharT, Traits >  lhs,
const std::basic_string< CharT, Traits > &  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator>= ( basic_string_view< CharT, Traits >  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept

Compares the two views lhs and rhs.

The ordering comparisons is done lexicographically. The comparison is performed by a function equivalent to std::lexicographical_compare.

Returns
true when lhs is greater or equal to rhs, otherwise false.
template<typename CharT , typename Traits >
constexpr bool rttr::operator>= ( const char *  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator>= ( basic_string_view< CharT, Traits >  lhs,
const char *  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator>= ( const std::basic_string< CharT, Traits > &  lhs,
basic_string_view< CharT, Traits >  rhs 
)
noexcept
template<typename CharT , typename Traits >
constexpr bool rttr::operator>= ( basic_string_view< CharT, Traits >  lhs,
const std::basic_string< CharT, Traits > &  rhs 
)
noexcept
template<typename... TArgs>
detail::parameter_names<detail::decay_t<TArgs>...> rttr::parameter_names ( TArgs &&...  args)

The parameter_names function should be used add human-readable names of the parameters, for constructors or a methods during the registration process of reflection information.

Use it in the () operator of the returned bind object.

The names must be provided as string literals (i.e. const char*) arguments.

See following example code:

using namespace rttr;
void set_window_geometry(const char* name, int w, int h) {...}
{
registration::method("set_window_geometry", &set_window_geometry)
(
parameter_names("window name", "width", "height")
);
}
See also
parameter_info
template<typename Target_Type , typename Source_Type >
Target_Type rttr::rttr_cast ( Source_Type  object)
noexcept

Casts the given object of type Source_Type to an object of type Target_Type.

When the given the given object is an instance of type Target_Type, then this function will cast the pointer to the TargetType; otherwise it will return a nullptr. If object is already a nullptr then it will also return a nullptr.

Remarks
Both class types must contain the macro RTTR_ENABLE in the class declaration. Source_Type and Target_Type must be both pointer types.
Returns
A pointer of type Target_Type
template<typename ClassType , typename ReturnType , typename... Args>
auto rttr::select_const ( ReturnType(ClassType::*)(Args...) const  func) -> decltype(func)

This is a helper function to register overloaded const member functions.

Use it like following:

#include <rttr/registration>
using namespace rttr;
struct Foo
{
void func() {}
void func() const {}
};
{
.method("func", select_non_const(&Foo::func))
.method("func", select_const(&Foo::func));
}
Remarks
The method cannot be used with MSVC x86 compiler, because of the different calling convention for global- and member-functions. As workaround you have to explicitly cast to the member function pointer:
{
registration::class_<Foo>("Foo")
.method("func", static_cast<void(Foo::*)()>(&Foo::func))
.method("func", static_cast<void(Foo::*)()const>(&Foo::func));
}
template<typename ClassType , typename ReturnType , typename... Args>
auto rttr::select_const ( ReturnType(ClassType::*)(Args...) const noexcept  func) -> decltype(func)

Overload with noexcept function type.

See also
select_const
template<typename ClassType , typename ReturnType , typename... Args>
auto rttr::select_non_const ( ReturnType(ClassType::*)(Args...)  func) -> decltype(func)

This is a helper function to register overloaded const member functions.

Use it like following:

#include <rttr/registration>
using namespace rttr;
struct Foo
{
void func() {}
void func() const {}
};
{
registration::class<Foo>("Foo")
.method("func", select_non_const(&Foo::func))
.method("func", select_const(&Foo::func));
}
Remarks
The method cannot be used with MSVC x86 compiler, because of the different calling convention for global- and member-functions. As workaround you have to explicitly cast to the member function pointer:
{
registration::class_<Foo>("Foo")
.method("func", static_cast<void(Foo::*)()>(&Foo::func))
.method("func", static_cast<void(Foo::*)()const>(&Foo::func));
}
template<typename ClassType , typename ReturnType , typename... Args>
auto rttr::select_non_const ( ReturnType(ClassType::*)(Args...) noexcept  func) -> decltype(func)

Overload with noexcept function type.

See also
select_const
template<typename Signature >
Signature* rttr::select_overload ( Signature *  func)

This is a helper function to register overloaded functions.

Use it like following:

#include <rttr/registration>
#include <cmath>
using namespace rttr;
{
registration::method("pow", select_overload<float(float, float)>(&pow));
}
Remarks
The method cannot be used with MSVC x86 compiler, because of the different calling convention for global- and member-functions. As workaround you have to explicitly cast to the function pointer:
{
registration::method("pow", static_cast<float(*)(float, float)>(&pow));
}
template<typename Signature , typename ClassType >
auto rttr::select_overload ( Signature ClassType::*  func) -> decltype(func)

This is a helper function to register overloaded member functions.

Use it like following:

#include <rttr/registration>
#include <cmath>
using namespace rttr;
struct Foo
{
void func(int) {}
void func(int, int) {}
};
{
.method("func", select_overload<void(int)>(&Foo::func))
.method("func", select_overload<void(int, int)>(&Foo::func));
}
Remarks
The method cannot be used with MSVC x86 compiler, because of the different calling convention for global- and member-functions. As workaround you have to explicitly cast to the member function pointer:
{
registration::class_<Foo>("Foo")
.method("func", static_cast<void(Foo::*)(int)>(&Foo::func))
.method("func", static_cast<void(Foo::*)(int, int)>(&Foo::func));
}
template<typename Enum_Type >
detail::enum_data<Enum_Type> rttr::value ( string_view  ,
Enum_Type  value 
)

The value function should be used to add a mapping from enum name to value during the registration process of reflection information.

Use it in the () operator of the returned bind object.

See also
registration::enumeration
template<class T >
T rttr::variant_cast ( const variant operand)

Returns a reference to the containing value as type T.

variant var = std::string("hello world");
std:string& value_ref = variant_cast<std::string&>(var); // extracts the value by reference
std:string value = variant_cast<std::string>(var); // copies the value
Remarks
Extracting a value type, which is not stored in the variant, leads to undefined behaviour. No exception or error code will be returned!
template<class T >
T rttr::variant_cast ( variant operand)

Returns a reference to the containing value as type T.

variant var = std::string("hello world");
std::string& value_ref = variant_cast<std::string&>(var); // extracts the value by reference
std::string value = variant_cast<std::string>(var); // copies the value
Remarks
Extracting a value type, which is not stored in the variant, leads to undefined behaviour. No exception or error code will be returned!
template<class T >
T rttr::variant_cast ( variant &&  operand)

Move the containing value from the variant into a type T.

variant var = std::string("hello world");
std::string& a = variant_cast<std::string&>(var);
std::string b = variant_cast<std::string>(std::move(var)); // move the value to 'b'
std::cout << "a: " << a << std::endl; // is now empty (nothing to print)
std::cout << "b: " << b << std::endl; // prints "hello world"
Remarks
Extracting a value type, which is not stored in the variant, leads to undefined behaviour. No exception or error code will be returned!
template<class T >
const T* rttr::variant_cast ( const variant operand)
noexcept

Returns a pointer to the containing value with type T.

When the containing value is of type T, a valid pointer to the type will be returned. Otherwise a nullptr is returned.

variant var = std::string("hello world");
std:string* a = variant_cast<std::string>(&var); // performs an internal type check and returns the value by reference
int* b = variant_cast<int>(&var);
std::cout << "a valid: " << a != nullptr << std::endl; // prints "1"
std::cout << "b valid: " << b != nullptr << std::endl; // prints "0"
Returns
A valid pointer, when the containing type is of type T; otherwise a nullptr.
template<class T >
T* rttr::variant_cast ( variant operand)
noexcept

Returns a pointer to the containing value with type T.

When the containing value is of type T, a valid pointer to the type will be returned. Otherwise a nullptr is returned.

variant var = std::string("hello world");
std:string* a = variant_cast<std::string>(&var); // performs an internal type check and returns the value by reference
int* b = variant_cast<int>(&var);
std::cout << "a valid: " << a != nullptr << std::endl; // prints "1"
std::cout << "b valid: " << b != nullptr << std::endl; // prints "0"
Returns
A valid pointer, when the containing type is of type T; otherwise a nullptr.