Boost logo

Boost Users :

From: Konstantin Litvinenko (Konstantin.Litvinenko_at_[hidden])
Date: 2006-06-09 06:51:24


Hello, Thorsten!
You wrote on Thu, 08 Jun 2006 23:57:32 +0200:

 TO>>> Do you agree that for ptr_set/ptr_map the return value should be
 TO>>> single object transfer: std::pair<iterator,size_type>
 KL>>
 KL>> Why not std::pair<iterator,bool> as std::set/std::map return?
 KL>>
 TO>>> multi object transfer: std::pair<iterator,size_type>
 KL>>
 KL>> May be only size_type?

 TO> Why do you need the iterator for single element transfer, but not for
 TO> multi element transfer?

Because I don't know what to do with returned iterator for multi object transfer. Where this iterator will be pointed to? On first inserted element? Last?
I think we need an usecase.

 KL>>
 KL>> I think for these two should be
 KL>>
 KL>> single object transfer: iterator // this operation always
 KL>> insert key/value pair multi object transfer: void // this
 KL>> operation always insert all key/value pairs

 TO> I have come to dislike variations in return-type, even for different
 TO> containers. It makes them less interchangeable. Do you disagree?
    Yes, I disagree :)
    Never seen easy way to change map on set or multimap on multiset. Such changes always require more modification than just replacing container type.

    std::set.insert(key) return pair
    std::set.insert(first, last) return void
    std::multiset.insert(key) return iterator
    std::multiset.insert(first, last) return void

    Why not to do the same, exept fo (first, last) return size to indicate how many insertion happens?

With best regards, Konstantin Litvinenko.


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