小编Ope*_*L97的帖子

类中的 ofstream - 尝试引用已删除的函数

我在类中有一个成员变量,其类型是ofstream和一个包含字符串参数的构造函数:

class dogs
{
public:
    ofstream dogsFile;

    dogs(string location)
    {

    }
};
Run Code Online (Sandbox Code Playgroud)

出现以下错误:

错误 2 错误 C2280: 'std::basic_ofstream>::basic_ofstream(const std::basic_ofstream> &)' : 尝试引用已删除的函数 c:\users\pc\documents\visual studio 2013\projects\database\database\数据库.cpp 26 1 数据库

我再次尝试了这段代码,但我没有使用字符串,而是使用了 char*:

class dogs
{
public:
    ofstream dogsFile;

    dogs(char* location)
    {

    }
};
Run Code Online (Sandbox Code Playgroud)

错误消失了。为什么?为什么字符串会出错?

编辑:这是整个代码:

#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>

using namespace std;


class dogs
{ 
    ofstream dogsFile;

public:
    dogs(string location)
    {

    }
};

int main(int argc, _TCHAR* argv[])
{
    dogs dog = dogs("dog.bin"); …
Run Code Online (Sandbox Code Playgroud)

c++ string parameters fstream char

6
推荐指数
1
解决办法
2573
查看次数

三角剖分 3D 算法

我在包含超过 3 个顶点的 3D 空间上有数千个多边形。我想将每个多边形划分为一组三角形。我一直在互联网上寻找,但在 3D 上找不到任何可以做到这一点的算法。我发现许多算法在 2D 上工作,例如ear clippingDelaunay triangulation。但我找不到任何 3D 算法。

我在这个网站上看到了许多相同的问题,这些问题的回答是“使用 Delaunay 三角剖分算法”。但我已经看到这个算法是用于 2D 的:http : //www.geom.uiuc.edu/~samuelp/del_project.html

实现一种算法,用于在二维中查找给定点集的约束 Delaunay 三角剖分。

我可以使用什么 3D 三角剖分算法?我在 C++ 中使用 OpenGL。

c++ opengl algorithm 3d

5
推荐指数
1
解决办法
5288
查看次数

UNITY 触摸位置到世界位置 2D

如何将触摸位置(在手机上)转换为世界位置。例如,如果我的手机屏幕尺寸是 1440 x 2560,而我在手机上的触摸位置是 X 600 Y 700。我如何才能将该位置转换为统一的世界位置?

我需要它,这样我才能知道用户将手指放在哪里。

android 2d screen touch unity-game-engine

5
推荐指数
1
解决办法
5569
查看次数

标签 统计

c++ ×2

2d ×1

3d ×1

algorithm ×1

android ×1

char ×1

fstream ×1

opengl ×1

parameters ×1

screen ×1

string ×1

touch ×1

unity-game-engine ×1