Bonjour.

J'ai un petit problème avec un vector de map, mon programme plante au constructeur de la classe C_FileData :

C_FileData.hpp :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef _CLASS_FILE_DATA_H
#define _CLASS_FILE_DATA_H
 
#include <stdlib.h>
#include <stdio.h>
#include <fstream>
#include <sstream>
#include <iostream>
#include <string>
#include <map>
#include <vector>
 
 
using namespace std;
 
/*
 
*/
 
 
 
class C_FileData
{
private:
 
    enum {WIDTH=0, HEIGHT=1, NOMBRE=2};
    vector<map<int, int> > m_DataDecors;
 
    enum{BASEX=0, BASEY=1, TAILLEX=2, TAILLEY=3};
    vector<map<int, int> > m_DataTextureSol;
 
public:
    // Constructeur.
    C_FileData();
 
    // Destructeur.
    ~C_FileData();
 
    //Connaitre les données
    const map<int, int> Get_DataDecors(int Decors) const;
    const map<int, int> Get_DataTextureSol(int TextureSol) const;
};
 
#endif
Constructeur de C_FileData :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
C_FileData::C_FileData()
{
    string buf;
    string resultat;
    string Nom_trouve;
    string buf_data;
    string chemin;
    int nombre, pos, temp;
    //CHARGEMENT DES TEXTURES DU SOL
    ifstream file("Data/interface.e");
    file >> buf;
    while (buf != "[/Texture_sol]")
    {
        fprintf(stderr, "%s\n", buf.c_str());
        pos = buf.find("=");
 
        resultat = buf.substr(pos-pos,pos);
        istringstream nbr_result(resultat);
        nbr_result >> nombre;
        resultat = "Images/Textures/Sol/";
        resultat += buf.substr(pos+1,buf.length()-pos);
 
        chemin=resultat+".tex";
        ifstream file_data(chemin.c_str());
        //Charge les données width de la texture
        file_data >> buf_data;
        pos = buf_data.find("=");
        resultat = buf_data.substr(pos+1,5);
        istringstream nbr_result2(resultat);
        map<int, int>::const_iterator It = m_DataTextureSol[nombre].find(WIDTH);
        if (It != m_DataTextureSol[nombre].end())
        {
            nbr_result2 >> temp;
            m_DataTextureSol[nombre][WIDTH] = temp;
        }
J'ai fait quelques tests, et je sais que c'est à la ligne
map<int, int>::const_iterator It = m_DataTextureSol[nombre].find(WIDTH);

que le programme plante... Si vous avez une solution, je suis preneur