如何使用VEC2类处理许多库

发布于 2025-02-03 20:41:29 字数 282 浏览 3 评论 0原文

我正在编写一个程序,该程序开始变得太大而无法单独编译。

在该项目中,我有许多“模块”,我认为我可以带出来成为他们自己的图书馆,这将使我能够在以后的项目中使用这些图书馆。

但是,许多这些库都取决于某种形式的简单2D点类(float x,float y)。

我的问题是我不知道如何在每个库中处理VEC2类,我是否在库的名称空间中编写一个简单的VEC2类,还是应该迫使用户首先安装其他共享库?

我怀疑第二个建议是理想的建议,但是我宁愿我的库对它们没有膨胀,因为它们主要包括一个.cpp + .h文件。

I am writing a program which is starting to get too big to compile individually.

Within the project, I have a number of 'modules' which I think I can take out to become their own library, and this will allow me to use those libraries in future projects.

A lot of these libraries however are dependant on some form of a simple 2D point class (float x, float y).

My issue is that I don't know how I should handle the Vec2 class within each library, do I write a simple Vec2 class within the library's namespace or should I force the user to install an additional shared library first?

I suspect the second suggestion is the ideal one however I would rather my libraries had no bloat to them as they will mostly include just a single .cpp + .h file.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文