Boost logo

Boost Users :

Subject: Re: [Boost-users] [unordered] Iterator default constructor usage
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2011-11-25 16:47:04


On Nov 25, 2011, at 1:07 PM, andpar83_at_[hidden] wrote:

> Hi all.
>
> Is it a correct usage of default constructor of iterators? Are any
> gurantees that it will always equals to the iterator returned by
> end()? :
>
> typedef boost::unordered_map<std::string, int> map;
> map x;
> x["one"] = 1;
>
> assert(x.find("missing") == x.end());
> assert(x.find("missing") == map::iterator());
> assert(map::iterator() == x.end());

How could they be?

Consider the following code:

        std::vector<int> v1, v2;
        std::vector::iterator i1;
        
Should
        i1 == v1.end ()
or i1 == v2.end ()

be true? (they cannot both be true)

-- Marshall

Marshall Clow Idio Software <mailto:mclow.lists_at_[hidden]>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki


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