Citation Envoyé par Rodrigue
Ah Ok! T'aurais pas un petit code d'exemple pour le std::map avec l'allocator() ?
Pas vraiment. Des pistes/exemples:
http://www.ddj.com/dept/cpp/184403759
http://allocator.sourceforge.net/
une fois que tu as codé ton allocator my_allocator, tu le fait utiliser par la STL ainsi:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
    typedef std::map<
        int,
        int,
        std::less<int>,
        my_allocator<std::pair<const int,int> > > my_map;
 
    typedef std::vector<
        int,
        my_allocator<int> > my_vector;
etc...