我有一组2D点,每个点都有一个相关的id.(例如,如果点存储在数组中,则id是每个点0,....,n-1的索引).
现在我创建了这些点的Delaunay三角剖分,并希望列出所有有限边.对于每个边,我想要由相应的2个顶点表示的点的id.示例:如果在点0和点2之间存在边缘,则为(0,2).这可能吗?
#include <vector>
#include <CGAL\Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL\Delaunay_triangulation_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Delaunay_triangulation_2<K> Delaunay;
typedef K::Point_2 Point;
void load_points(std::vector<Point>& rPoints)
{
rPoints.push_back(Point(10,10)); // first point
rPoints.push_back(Point(60,10)); // second point
rPoints.push_back(Point(30,40)); // third point
rPoints.push_back(Point(40,80)); // fourth point
}
void main()
{
std::vector<Point> points;
load_points(points);
Delaunay dt;
dt.insert(points.begin(),points.end());
for(Delaunay::Finite_edges_iterator it = dt.finite_edges_begin(); it != dt.finite_edges_end(); ++it)
{
}
}
Run Code Online (Sandbox Code Playgroud) 要声明浮点数,我们需要为浮点数设置'f',为双打设置'd'.
例:
float num1 = 1.23f; // float stored as float
float num2 = 1.23; // double stored as float. The code won't compile in C#.
Run Code Online (Sandbox Code Playgroud)
据说如果省略浮点文字,C#默认为double.
我的问题是,是什么阻止了像'C#'这样的现代语言对左侧变量类型的'DEFAULTS'?毕竟,编译器可以看到整行代码.
这是出于编译器设计的历史原因吗?或者有什么我没有得到的.
我在不同的地理位置(本地站点)有几个 PostgreSQL 数据库。
问题:如何使用 PostgreSQL 复制方法实现这一点?(流媒体/多主 UDR/BDR/等)
限制:本地站点只能进行传出网络连接(即由于防火墙限制不能进行入站连接)
postgresql replication database-replication transactional-replication
为什么std::queue用std::vector容器创建不会引起编译器错误?
只有在调用pop时才会出现编译器错误(这很明显,因为vector不提供pop_front()).
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
int main()
{
queue<int, vector<int>> s;
s.push(10);
cout << s.front() << endl;
s.pop();
return 0;
}
Run Code Online (Sandbox Code Playgroud)