Sign in to follow this  
japro

The Vector conundrum

Recommended Posts

japro    887
Hi,

edit: I thought the "subtitle" would be more prominently displayed. I guess I should also mention in the post that this is mainly about C++.

so this is a problem that comes up almost every time I start a project. I'm always unsure what Vector type (in the mathematical sense) I should use. Usually when you use additional libraries you end up with competing Vector datatypes... Box2D, SFML etc. all define their own and if you want to build additional components that are more general purpose (say a path finding mesh) you also want to use a vector type that preferably doesn't depend on an "unrelated" library (I don't want include SFML into every project just for the Vector type). So I lately just decided to use Eigen wherever possible to get some consistency. In the past I often used a self written version or even just plain arrays.

Somewhat similar issues also arise with other things like some libraries having their own string classes and such, this is just the one I run into the most.

How do you deal with this?

Share this post


Link to post
Share on other sites
alnite    3436
I would use your own internal format (arrays, a class, whatever), and provide converters to different libraries' vector classes. That way you can uniformly use your own format for your classes, then when necessary, convert it to another.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this