各位大家好,感谢您抽出宝贵时间阅读本文 . 所以基本上我试图通过文本文件读取我读过的数据并将其存储到: std::map<double,pair<double,double>>storage 其中第一个双精度表示坐标的ID,而对表示x和y值,可以忽略z值 .

ID X Y Z / n ID X Y Z.

类顶点

class vertex
   {
   public:

        map<double,pair<double,double>> keyTable;
        int count = 0; // just temporary to count the number of lines
        ifstream filestuff; //used later to initialize the reference

        double vert_id; //The ID of the Vertex will be stored here
        int num_vert,num_attrib,num_dimen; //First line of the .tri file
        //Declare class as a friend to take the ifstreamed file from main
        friend ifstream& operator >> (ifstream& input, vertex &vert){
            input>>vert.num_vert>>vert.num_dimen>>vert.num_attrib;
            return input;
        }
    vertex();
    virtual ~vertex();
    protected:
    private:
    double x,y,z; // Coordinate points
 };

在构造函数中

vertex::vertex(){

    ifstream& input = filestuff; // text file passed as a reference

    while (getline(filestuff, line)) {
        count++

        while (count<num_vert) // for loop to stop at a
        {
        //add to the map and pray to god its okay
        keyTable.insert(?);
         // MAP STORED AS KEY = ID and pair of points is X and Y
        }      


      }

    return;
        //ctor
 }