当前位置:网站首页>Detect whether the vector has an intersection
Detect whether the vector has an intersection
2022-06-12 12:41:00 【April 16!】
#include <iostream> // std::cout
#include <algorithm> // std::find_if
#include <vector> // std::vector
auto test(const std::vector< itk::Index<3>>& va, const std::vector< itk::Index<3>>& vb)
{
bool result{ false };
auto vbIter = std::find_if(vb.cbegin(), vb.cend(), [&va](const auto& bandItem)
{
auto vaIter = std::find_if(va.cbegin(), va.cend(), [&bandItem](const auto& nrBandItem)
{
return nrBandItem == bandItem;
});
return vaIter != va.cend();
});
result = (vbIter != vb.cend());
return result;
}
int main(int, char *[])
{
std::vector< itk::Index<3>> v1{ {0,1,2},{12,-10,25} };
std::vector< itk::Index<3>> v2{ {0,1,2} };
std::vector< itk::Index<3>> v3{ {1,2,3} };
std::cout << test(v1, v2) << std::endl;
std::cout << test(v1, v3) << std::endl;
return 0;
}
边栏推荐
- You can't just use console Log ()?
- A short guide to SSH port forwarding
- 轻量化---Project
- Principle of master-slave replication of redis
- [HXBCTF 2021]easywill
- Examples of Cartesian product and natural connection of relational algebra
- Differences and recommended uses of VaR, let and const (interview)
- A "murder case" caused by ES setting operation
- Introduction, installation and use of core JS
- Geek challenge 2021 Web
猜你喜欢

JS how to convert a string into an array object

Array -- seven array topics with double pointer technique
![[C language] keyword static & Multi file & guessing game](/img/82/fa3556522531f83e95938fc4efbf1e.png)
[C language] keyword static & Multi file & guessing game

一个ES设置操作引发的“血案”

路由信息的来源

Binary tree (construction)

VGG小卷积代替大卷积 VS 深度可分离卷积

常数时间删除/查找数组中的任意元素

Is yuancosmos a short-term speculation or a future trend?

从基础到源码统统帮你搞定,技术详细介绍
随机推荐
Suggestions and skills for advanced version of go language test
Influxdb2.x benchmark tool - influxdb comparisons
Implementation principle of kotlin extension function
Pre order, middle order and post order traversal of tree
Tron API wave field transfer query interface PHP version package based on thinkphp5 attached interface document 20220602 version deployed interface applicable to any development language
JS built in object
Deep analysis of advanced pointer -- advanced chapter of C language
Object value taking method in JS And []
Soft test network engineer notes
Promise+ handwritten promise
The 4th Zhejiang CTF preliminary contest web pppop
关于派文的问题
时序数据库 - InfluxDB2 docker 安装
Typeof and instanceof, how to simulate the implementation of an instanceof? Is there a general detection data type?
JS method of exporting DOM as picture
A "murder case" caused by ES setting operation
AND THE BIT GOES DOWN: REVISITING THE QUANTIZATION OF NEURAL NETWORKS
itk::Neighborhood获取6邻域、18邻域、26邻域,18/6邻域,26/18邻域
C语言【23道】经典面试题【下】
Buu question brushing record - 6