Bonjour,
j'ai besoin dans un programme d'utiliser un tableau de list d'une classe pixel.
Je fait donc la déclaration de ma classe pixel
Ensuite je crée un tableau de list de pixel:
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 #ifndef PIX #define PIX class pixel{ public: int x,y; int level; public: pixel(int X,int Y,int L){x=X;x=Y;level=L;} pixel& operator=(pixel& p){x=p.x;y=p.y;level=p.level;} /*int getX(){return x;} int getY(){return y;} int getL(){return level;} */ }; #endif
Le probleme surviens quand je l'utilise dans une autre classe:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 list<pixel> *ex; ex = new list<pixel>[256] for(int i=0;i<256;i++) explorelist[i] = list<pixel>();
Voila les erreurs:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 bool mafonctionpixel (pixel &p) { p = explorelist[i].pop_front().x; // ca me fait une erreur return true; }
Si quelqu'un pouvait m'aider.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 /usr/include/c++/4.4/bits/list.tcc: In member function std::list<_Tp, _Alloc>& std::list<_Tp, _Alloc>::operator=(const std::list<_Tp, _Alloc>&) [with _Tp = pixel, _Alloc = std::allocator<pixel>]: src/WatershedGrayLevel.cpp:16: instantiated from here /usr/include/c++/4.4/bits/list.tcc:143: error: no match for operator= in __first1.std::_List_iterator<_Tp>::operator* [with _Tp = pixel]() = __first2.std::_List_const_iterator<_Tp>::operator* [with _Tp = pixel]() src/pixel.h:23: note: candidates are: pixel& pixel::operator=(pixel&) make: *** [src/WatershedGrayLevel.o] Erreur 1 rm src/*.o make: La cible « all » n'a pas pu être refabriquée à cause d'erreurs.
D'avance merci.
Partager