Bonjour !

J'essaye d'avoir cette map:
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
class L {
    /** plus de code **/
    map<int, pair<SDL_Surface*, SDL_Surface*>> plop
}
SDL_Surface* L::GetL(int id)
{
    return (plop.find(id)->second).first;
}
void L::C(int id, SDL_Rect rect, int destid)
{
    SDL_Surface* surf = new SDL_Surface();
    surf->w = rect.w;
    surf->h = rect.h;
    plop.insert(id, make_pair(GetL(destid), surf));
}

Le code bug au moment ou je fais le insert.

Voici l'erreur:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
D:\C++\projects\Client v2\Factories\L.cpp||In member function 'void L::C(int, SDL_Rect, int)':|
D:\C++\projects\Client v2\Factories\L.cpp|19|error: no matching function for call to 'std::map<int, std::pair<SDL_Surface*, SDL_Surface*>, std::less<int>, std::allocator<std::pair<const int, std::pair<SDL_Surface*, SDL_Surface*> > > >::insert(int&, std::pair<SDL_Surface*, SDL_Surface*>)'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\bits\stl_map.h|499|note: candidates are: std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const std::pair<const _Key, _Tp>&) [with _Key = int, _Tp = std::pair<SDL_Surface*, SDL_Surface*>, _Compare = std::less<int>, _Alloc = std::allocator<std::pair<const int, std::pair<SDL_Surface*, SDL_Surface*> > >]|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\bits\stl_map.h|511|note:                 void std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::initializer_list<std::pair<const _Key, _Tp> >) [with _Key = int, _Tp = std::pair<SDL_Surface*, SDL_Surface*>, _Compare = std::less<int>, _Alloc = std::allocator<std::pair<const int, std::pair<SDL_Surface*, SDL_Surface*> > >]|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\bits\stl_map.h|539|note:                 typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::pair<const _Key, _Tp> >::other>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::pair<const _Key, _Tp> >::other>::iterator, const std::pair<const _Key, _Tp>&) [with _Key = int, _Tp = std::pair<SDL_S|
||=== Build finished: 1 errors, 0 warnings ===|
Qu'est-ce qui ne va pas? :o