...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::icl::split_interval_map — implements a map as a map of intervals - on insertion overlapping intervals are split and associated values are combined.
// In header: <boost/icl/split_interval_map.hpp>
template<typename DomainT, typename CodomainT,
typename Traits = icl::partial_absorber,
ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT),
ICL_COMBINE Combine = ICL_COMBINE_INSTANCE(icl::inplace_plus, CodomainT),
ICL_SECTION Section = ICL_SECTION_INSTANCE(icl::inter_section, CodomainT),
ICL_INTERVAL(ICL_COMPARE) Interval = ICL_INTERVAL_INSTANCE(ICL_INTERVAL_DEFAULT, DomainT, Compare),
ICL_ALLOC Alloc = std::allocator>
class split_interval_map : public boost::icl::interval_base_map< boost::icl::split_interval_map< DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc >, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc >
{
public:
// types
typedef Traits traits; // Traits of an itl map.
typedef split_interval_map< DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc > type;
typedef interval_map< DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc > joint_type;
typedef type overloadable_type; // Auxilliary type for overloadresolution.
typedef interval_base_map< type, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc > base_type;
typedef DomainT domain_type; // Domain type (type of the keys) of the map.
typedef CodomainT codomain_type; // Domain type (type of the keys) of the map.
typedef base_type::iterator iterator; // iterator for iteration over intervals
typedef base_type::value_type value_type; // value type of the implementing container
typedef base_type::element_type element_type; // Conceptual is a map a set of elements of type element_type
.
typedef base_type::segment_type segment_type; // Type of an interval containers segment, that is spanned by an interval.
typedef base_type::domain_mapping_type domain_mapping_type; // Auxiliary type to help the compiler resolve ambiguities when using std::make_pair.
typedef base_type::interval_mapping_type interval_mapping_type; // Auxiliary type for overload resolution.
typedef base_type::ImplMapT ImplMapT; // Container type for the implementation.
typedef base_type::codomain_combine codomain_combine;
typedef interval_set< DomainT, Compare, Interval, Alloc > interval_set_type;
typedef interval_set_type set_type;
typedef set_type key_object_type;
// construct/copy/destruct
split_interval_map();
split_interval_map(const split_interval_map &);
explicit split_interval_map(const domain_mapping_type &);
explicit split_interval_map(const value_type &);
split_interval_map(split_interval_map &&);
split_interval_map& operator=(const split_interval_map &);
template<typename SubType>
split_interval_map&
operator=(const interval_base_map< SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc > &);
split_interval_map& operator=(split_interval_map &&);
// public member functions
typedef ICL_INTERVAL_TYPE(Interval, DomainT, Compare);
template<typename SubType>
void assign(const interval_base_map< SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc > &);
// private member functions
iterator handle_inserted(iterator) const;
void handle_inserted(iterator, iterator) const;
template<typename Combiner> void handle_left_combined(iterator);
template<typename Combiner> void handle_combined(iterator);
template<typename Combiner>
void handle_preceeded_combined(iterator, iterator &);
template<typename Combiner>
void handle_succeeded_combined(iterator, iterator);
void handle_reinserted(iterator);
template<typename Combiner>
void gap_insert_at(iterator &, iterator, const interval_type &,
const codomain_type &);
};
split_interval_map
public
construct/copy/destructsplit_interval_map();Default constructor for the empty object.
split_interval_map(const split_interval_map & src);Copy constructor.
explicit split_interval_map(const domain_mapping_type & base_pair);
explicit split_interval_map(const value_type & value_pair);
split_interval_map(split_interval_map && src);Move constructor.
split_interval_map& operator=(const split_interval_map & src);Assignment operator.
template<typename SubType> split_interval_map& operator=(const interval_base_map< SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc > & src);Assignment operator for base type.
split_interval_map& operator=(split_interval_map && src);Move assignment operator.
split_interval_map
public member functionstypedef ICL_INTERVAL_TYPE(Interval, DomainT, Compare);The interval type of the
map
. template<typename SubType> void assign(const interval_base_map< SubType, DomainT, CodomainT, Traits, Compare, Combine, Section, Interval, Alloc > & src);Assignment from a base
interval_map
. split_interval_map
private member functionsiterator handle_inserted(iterator it_) const;
void handle_inserted(iterator, iterator) const;
template<typename Combiner> void handle_left_combined(iterator it_);
template<typename Combiner> void handle_combined(iterator it_);
template<typename Combiner> void handle_preceeded_combined(iterator prior_, iterator & it_);
template<typename Combiner> void handle_succeeded_combined(iterator it_, iterator);
void handle_reinserted(iterator);
template<typename Combiner> void gap_insert_at(iterator & it_, iterator prior_, const interval_type & end_gap, const codomain_type & co_val);