Binding template member functions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Binding template member functions

Steven Webb-2
My C++ terminology may be wrong, but is it possible to bind a template member function using luabind?

I'm using RakNet, and the following template method definition appears in the BitStream class (http://www.jenkinssoftware.com/raknet/manual/Doxygen/classRakNet_1_1BitStream.html#260675ffb5cb824cbed3465b0319383c)

// Write any integral type to a bitstream.
template<class templateType >
void RakNet::BitStream::Write ( const templateType &  inTemplateVar  )  [inline]

Is it possible to bind this directly using luabind? Or do I need to create some sort of wrapper?

Thanks for making this great software!

Steve.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: Binding template member functions

Willi Schinmeyer
Am 28.05.2012 09:46, schrieb Steven Webb:
> My C++ terminology may be wrong, but is it possible to bind a template
> member function using luabind?
Yes, I think so. At least I've previously successfully bound an ordinary
template function - instead of &function it's simply &function<type>, so
I guess in your case it'd be e.g. &Class::MemberFunction<int>

You just can't keep the template. You can however have multiple versions
of the same name and function overloading should pick the correct one.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: Binding template member functions

Steven Webb-2
Cheers. That syntax is compiling so I think it's working (I haven't had a chance to test it properly yet).

Steve.

On 28 May 2012 16:09, Willi Schinmeyer <[hidden email]> wrote:
Am 28.05.2012 09:46, schrieb Steven Webb:
> My C++ terminology may be wrong, but is it possible to bind a template
> member function using luabind?
Yes, I think so. At least I've previously successfully bound an ordinary
template function - instead of &function it's simply &function<type>, so
I guess in your case it'd be e.g. &Class::MemberFunction<int>

You just can't keep the template. You can however have multiple versions
of the same name and function overloading should pick the correct one.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user