Boost logo

Boost Users :

Subject: [Boost-users] [icl] 'map::_add' ignores default-constructed value
From: Filip Konvička (filip.konvicka_at_[hidden])
Date: 2015-10-29 10:27:26


Hi,

First of all thanks very much for the ICL!

I'm using a boost::icl::interval_map with my own value type (struct V)
and I have a custom value combining logic by passing
boost::icl::inplace_et to the map and defining my own "operator&=" that
provides the logic implementation.

Now what happens is that my map ignores "m += make_pair(..., V())"
because the default-constructed value is considered neutral due to:

boost/icl/interval_base_map.hpp:

... interval_base_map<...>::_add(const segment_type& addend) {
     typedef typename on_absorbtion<type,Combiner,
absorbs_identities<type>::value>::type on_absorbtion_;
...
     const codomain_type& co_val = addend.second;
     if(on_absorbtion_::is_absorbable(co_val))
         return this->_map.end();

This 'if' returns without actually modifying the map. Is there some
public API that I can use to tell my map that it should not consider any
value 'absorbable'? And is it a good idea to change this?

Thank you,
Filip


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