gpt4 book ai didi

c++ - 我应该如何在cpp中设计一个结构?

转载 作者:太空宇宙 更新时间:2023-11-03 10:38:08 28 4
gpt4 key购买 nike

<分区>

我有以下结构:

struct Point {
double x, y;
std::string name;
vector<vector<double>> matrix;
}

我从一开始就知道除了最后一个属性 matrix 之外的所有属性,为了计算 matrix 我必须知道其他一些对象。

但是我想将 matrix 保留在 Point 结构中。因为没有 point_id 或类似的东西,所以我可以创建 map 。

仅使用 (x, y, name) 构造函数然后在代码中显式设置 matrix 是否是一种好的风格。

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com