gpt4 book ai didi

android - 如何在 Android 中实现 C++ vector ?

转载 作者:行者123 更新时间:2023-11-28 00:42:02 25 4
gpt4 key购买 nike

我在 Android 中使用 opencv 库。我在 C++ 中找到了一些用于图像处理的代码,其中包含以下行:

    vector<pair<CvPoint, pair<double, double> > > hlines;

如何在 android 中创建这样的结构以保存一个点和两个 double ?

最佳答案

Java 没有对; Java 程序员倾向于为这类事情编写自己的类。例如,

class HLine {
public final CvPoint point;
public final double x;
public final double y;

public HLine(CvPoint point, double x, double y) {
this.point = point;
this.x = x;
this.y = y;
}
}

然后你可以创建一个ArrayList<HLine> .

关于android - 如何在 Android 中实现 C++ vector ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18429134/

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