相关疑难解决方法(0)

我可以使用'=='来比较两个向量.我试过了,似乎工作正常.但我不知道它是否适用于更复杂的情况

第一个例子:

int main(){
    using namespace std;   
    vector<int> v1{10, 20, 30, 40, 50};
    vector<int> v2{10, 20, 30, 40, 50};

    if(v1==v2)
        cout<<"equal";
    else
        cout<<"unequal";
}   // it returns equal 
Run Code Online (Sandbox Code Playgroud)

第二个例子:

int main(){
    using namespace std;   
    vector<int> v1{10, 20, 30, 40, 50};
    vector<int> v2{10, 20, 100000, 40, 50};

    if(v1==v2)
        cout<<"equal";
    else
        cout<<"unequal";
}   // it returns notequal 
Run Code Online (Sandbox Code Playgroud)

c++ equality vector operator-overloading

44
推荐指数
3
解决办法
5万
查看次数

如何比较两个std :: set?

我比较两个 std::set

#include <cstdlib>
#include <cstdio>
using namespace std;

#include <vector>
#include <set>


int main(int argc, char** argv)
{
    int myints1[]= {10,20,30,40,50};
    int myints2[]= {50,40,30,20,10};
    std::set<int> s1 (myints1,myints1+5);
    std::set<int> s2(myints2,myints2+5);
    if(s1==s2){
        printf("sets: true");
    }else printf("sets: false");
    std::set<int>::iterator it2=s2.begin();
    for(std::set<int>::iterator it1=s1.begin();it1!=s1.end();it1++){
                printf("\ns1: %d  s2: %d",*it1,*it2);
        it2++;
    }
}
Run Code Online (Sandbox Code Playgroud)

输出:

sets: true
s1: 10  s2: 10
s1: 20  s2: 20
s1: 30  s2: 30
s1: 40  s2: 40
s1: 50  s2: 50
Run Code Online (Sandbox Code Playgroud)

题:

这是正确的方法吗?或者是比较两组的任何其他(特殊)方式?

c++ std set

32
推荐指数
3
解决办法
5万
查看次数

比较两个向量C++

我想知道是否有任何函数比较2个字符串向量来返回不同(或相同)元素的数量?或者我必须迭代它们并逐项测试.
谢谢.

c++ stl

18
推荐指数
3
解决办法
4万
查看次数

比较android中的两个面孔

我正在开发一个应用程序,它可以在Surface视图的帮助下比较存储在SD卡中的面部和相机预览中显示的图像.我编写了代码来检测面部并创建了一个仅包含面部的位图.我需要比较这个位图和SD卡中的图像.我搜索过java库,并获得了一些像opencv,Eigenface这样的链接.哪个更好的图书馆?请给我一些很好的教程样本,如果它解释图像比较背后的过程会更好.

java android image-comparison image-processing face-detection

5
推荐指数
0
解决办法
4609
查看次数