-
- realm_mike
- Posts: 5
- Joined:
Issue with C++ getter that returns Noesis::String by value
Hi,
I have a struct that I'm trying to reflect where the getter function creates a Noesis::String for the UI 'just in time' as it's needed for the UI:
However this is throwing a compile error, and I believe the reason is that the internal TypePropertyFunction is only considering a getter that returns a const T& because IsBestByCopy<String> is false.
Can you adjust the internal template deduction logic so that you detect that the getter doesn't support returning a const T& and can fall back to ByCopy even though it's not 'Best' ?
I have a struct that I'm trying to reflect where the getter function creates a Noesis::String for the UI 'just in time' as it's needed for the UI:
Code: Select all
struct Message : Noesis::BaseComponent
{
MessageInternal* pMessage;
Noesis::String GetText() const
{
std::string s;
pMessage->GetText(&s);
return Noesis::String(s.c_str());
}
NS_IMPLEMENT_INLINE_REFLECTION(Message, Noesis::BaseComponent)
{
NsProp("Text", &Message::GetText);
}
};
Can you adjust the internal template deduction logic so that you detect that the getter doesn't support returning a const T& and can fall back to ByCopy even though it's not 'Best' ?
Re: Issue with C++ getter that returns Noesis::String by value
Please, file a ticket about this although I think this is something we cannot fix in 3.2 (probably we will need a major version for this change and more things pending in the reflection architecture)
Who is online
Users browsing this forum: No registered users and 1 guest