Boost logo

Boost Users :

Subject: [Boost-users] [ptr_container] view_clone_allocator with associative containers
From: Matthias Vallentin (vallentin_at_[hidden])
Date: 2010-02-28 21:10:37


I cannot get the view_clone_allocator to work with associative containers, as
in the example below:

    boost::ptr_vector<int> vec;
    boost::ptr__map<std::string, int, boost::view_clone_allocator> map;

    int* i = new int(42);
    vec.push_back(i);

    std::string k("foo");
    map.insert(k, i);

>From the error message, it seems that the CloneAllocator is still of
type boost::heap_clone_allocator.

Why is this failing? It seems intuitive to specify the allocator as
third parameter, similar to the example with ptr_vector where the
allocator is the second argument.

   Matthias

-- 
Matthias Vallentin
vallentin_at_[hidden]
http://www.icir.org/matthias

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net