|
Boost Users : |
Subject: Re: [Boost-users] [Unordered] size() != distance(begin(), end())
From: Daniel James (dnljms_at_[hidden])
Date: 2010-09-13 10:47:46
On 13 September 2010 14:21, Hossein Haeri <powerprogman_at_[hidden]> wrote:
>
> I have an instance of boost::unordered_map<> somewhere in my codebase (GCC 4.5.1, MinGW, WinXP) with the following funny piece of test code:
>
> container_[id].insert(v);
What's the full type of the unordered_map? As you seem to be inserting
into the mapped value, is that right?
> cout << "container insertion succesful" << endl;
> cout << "The container now contains " << container_.size() << " ids in it." << endl;
> cout << "distance from begin to end = " << distance(container_.begin(), container_.end()) << endl;
Can you try changing that to 'std::distance(container_.begin(),
container_.end())' to make sure that the correct function is called.
> Am I missing anything? Or, is this a bug in the implementation of boost::unordered_map<>?
It might be. Would it be possible to create a compilable demonstration
of the issue? Or some more information on how you set up the container
and what methods you have called?
Daniel
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