Created
April 2, 2013 02:11
-
-
Save chadaustin/5289435 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template< | |
typename GetterReturnType, | |
typename GetterThisType, | |
typename SetterArgumentType, | |
typename SetterThisType> | |
value_struct& field( | |
const char* fieldName, | |
GetterReturnType (*getter)(const GetterThisType&), | |
void (*setter)(SetterThisType&, SetterArgumentType) | |
) { | |
using namespace internal; | |
_embind_register_struct_field( | |
TypeID<ClassType>::get(), | |
fieldName, | |
TypeID<GetterReturnType>::get(), | |
reinterpret_cast<GenericFunction>( | |
&PropertyAccess<ClassType, GetterReturnType> | |
::template propertyGet<decltype(getter)>), | |
getContext(getter), | |
TypeID<SetterArgumentType>::get(), | |
reinterpret_cast<GenericFunction>( | |
&PropertyAccess<ClassType, SetterArgumentType> | |
::template propertySet<decltype(setter)>), | |
getContext(setter)); | |
return *this; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment