我刚刚从Sublime Text切换到Atom,以便完全开源.
我有一些非常简单的问题:我希望Atom使用always(!)并且在任何情况下使用tab宽度2并用空格替换tab.这个设置在gedit或Sublime Text中非常简单,但无论我在尝试什么:当我开始一个新文件时,标签大小为2(好!).当我使用现有文件时,标签大小有时为4.我发现有点烦人.
我在编辑器中的当前设置可以在屏幕截图中看到:
我花了大约两个小时来解决这个问题,之前我曾访问过这些stackoverflow问题:
两个都没有帮助我,所以我在这里指出我的问题:
1)我有一个Polygon将Point2Ds 存储在列表中的类.该课程有两个成员函数:
public:
std::pair<Point2D,Point2D> closestPts() const;
private:
Tripel const& findClosestPts (std::vector<Point2D> const& P,
std::vector<Point2D> const& X,
std::vector<Point2D> const& Y) const;
Run Code Online (Sandbox Code Playgroud)
2)该类还包含一个struct Triple函数的返回值findClosestPts.我需要那个,因为函数需要返回两个点和一个距离:
struct Tripel {
Point2D pt1;
Point2D pt2;
float dist;
};
Run Code Online (Sandbox Code Playgroud)
现在问题在于Polygon.cpp的实现.这是我上面提到的两个函数的(当前)代码:
std::pair<Point2D,Point2D> Polygon::closestPts() const {
...
int size = m_points.size();
std::vector<Point2D> P (size);
std::vector<Point2D> X (size);
std::vector<Point2D> Y (size);
...
// some manipulation of the vectors, filling them with Point2D
// at this point, I …Run Code Online (Sandbox Code Playgroud)