Welcome Guest Search | Active Topics | Log In | Register

full template support for get and set
#1 Posted : Saturday, August 12, 2017 2:53:05 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/12/2017(UTC)
Posts: 1

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
I've been putting together a patch for SqPlus, and wanted to share the idea and see what people thought. So I'm working with a templated library, and was trying to add Squirrel to it in an elegant way. SquirrelObject::Get<>() and Set<>() work for types you bind to SqPlus, but not to types native to Squirrel. What this means is that if you have two SquirrelObjects, and one contains a bool and the other a Vector3, you'd need to do this:

bool mBool = sqobj1.GetAsBool();
Vector3 mVector = sqobj2.Get<Vector3>();

I'm proposing to expand the get and set methods to handle native types as well, to make the code look like this:

bool mBool = sqobj1.Get<bool>();

Vector3 mVector = sqobj2.Get<Vector3>();

Once I'm done, the question is whether or not to keep all the GetAsType() functions, as their functionality is just duplicated in Get<Type>(). My vote is to remove them to make the code cleaner, but there may be people who feel strongly otherwise.
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Clean Slate theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.080 seconds.