Boost logo

Boost Users :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-02-18 17:59:38


Charles Brockman skrev:
> Thorsten Ottosen wrote:
>> There are some minor differences between std::map<K,T> and
>> boost::ptr_map<K,T> and if this the types that gives you errors, it
>> might be due to these differences.
>> For example, boost::ptr_map<K,T>:::value_type is not a
>> std::pair<const K,T>.
>> There are also some difference in the way constness is handled, which
>> might also be the source of your problem. Anyway, I would like to
>> know more.
>
> I constructed this short do-nothing program, zip_ptr_container_test.cpp.
> //
> #include <boost/tuple/tuple.hpp>
> #include <boost/iterator/zip_iterator.hpp>
> #include <map>
> #include <boost/ptr_container/ptr_map.hpp>
>
> using boost::zip_iterator;
> using boost::tuple;
> using boost::make_tuple;
> using boost::ptr_map;
> using std::map;
>
> int main() {
> //typedef map<int, int> theMapType;
> typedef boost::ptr_map<int, int> theMapType;
> typedef zip_iterator
> <tuple<theMapType::iterator, theMapType::iterator> > zipIter;
> theMapType map1;
> theMapType map2;
> zipIter(make_tuple(map1.begin(), map2.begin()));
> }
[snip]
>
> Are these problems correctable?
>

I can't figure out where the error is from that. Gcc also fails to
compile it, which is good.

I don't understand the metaprogramming machinery that boost.iterator is
doing here, but apparently my implementation of ptr_map's iterators
somehow violate a requirement.

-Thorsten


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