/usr/include/boost/icl/detail
NameSizeModeActions
associated_value.hpp15570644editdlrm
boost_config.hpp10320644editdlrm
concept_check.hpp9580644editdlrm
design_config.hpp56080644editdlrm
element_comparer.hpp57360644editdlrm
element_iterator.hpp146290644editdlrm
exclusive_less_than.hpp10510644editdlrm
interval_map_algo.hpp57410644editdlrm
interval_morphism.hpp42340644editdlrm
interval_set_algo.hpp205880644editdlrm
interval_subset_comparer.hpp121010644editdlrm
mapped_reference.hpp71690644editdlrm
map_algo.hpp26590644editdlrm
notate.hpp16870644editdlrm
on_absorbtion.hpp13410644editdlrm
relation_state.hpp12720644editdlrm
set_algo.hpp44940644editdlrm
std_set.hpp12890644editdlrm
subset_comparer.hpp81050644editdlrm
Edit: /usr/include/boost/icl/detail/interval_map_algo.hpp (5741B)
/*-----------------------------------------------------------------------------+ Copyright (c) 2008-2010: Joachim Faulhaber +------------------------------------------------------------------------------+ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENCE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +-----------------------------------------------------------------------------*/ #ifndef BOOST_ICL_INTERVAL_MAP_ALGO_HPP_JOFA_100730 #define BOOST_ICL_INTERVAL_MAP_ALGO_HPP_JOFA_100730 #include #include #include #include #include #include #include #include #include #include namespace boost{namespace icl { namespace Interval_Map { using namespace segmental; template bool is_joinable(const IntervalMapT& container, typename IntervalMapT::const_iterator first, typename IntervalMapT::const_iterator past) { if(first == container.end()) return true; typename IntervalMapT::const_iterator it_ = first, next_ = first; ++next_; const typename IntervalMapT::codomain_type& co_value = icl::co_value(first); while(it_ != past) { if(icl::co_value(next_) != co_value) return false; if(!icl::touches(key_value(it_++), key_value(next_++))) return false; } return true; } //------------------------------------------------------------------------------ //- Containedness of key objects //------------------------------------------------------------------------------ //- domain_type ---------------------------------------------------------------- template typename enable_if >, bool>::type contains(const IntervalMapT& container, const typename IntervalMapT::domain_type& key) { return container.find(key) != container.end(); } template typename enable_if, bool>::type contains(const IntervalMapT&, const typename IntervalMapT::domain_type&) { return true; } //- interval_type -------------------------------------------------------------- template typename enable_if >, bool>::type contains(const IntervalMapT& container, const typename IntervalMapT::interval_type& sub_interval) { typedef typename IntervalMapT::const_iterator const_iterator; if(icl::is_empty(sub_interval)) return true; std::pair exterior = container.equal_range(sub_interval); if(exterior.first == exterior.second) return false; const_iterator last_overlap = prior(exterior.second); return icl::contains(hull(exterior.first->first, last_overlap->first), sub_interval) && Interval_Set::is_joinable(container, exterior.first, last_overlap); } template typename enable_if, bool>::type contains(const IntervalMapT&, const typename IntervalMapT::interval_type&) { return true; } //- set_type ------------------------------------------------------------------- template typename enable_if > ,is_interval_set >, bool>::type contains(const IntervalMapT& super_map, const IntervalSetT& sub_set) { return Interval_Set::within(sub_set, super_map); } template typename enable_if ,is_interval_set >, bool>::type contains(const IntervalMapT&, const IntervalSetT&) { return true; } //------------------------------------------------------------------------------ //- Containedness of sub objects //------------------------------------------------------------------------------ template bool contains(const IntervalMapT& container, const typename IntervalMapT::element_type& key_value_pair) { typename IntervalMapT::const_iterator it_ = container.find(key_value_pair.key); return it_ != container.end() && (*it_).second == key_value_pair.data; } template bool contains(const IntervalMapT& container, const typename IntervalMapT::segment_type sub_segment) { typedef typename IntervalMapT::const_iterator const_iterator; typename IntervalMapT::interval_type sub_interval = sub_segment.first; if(icl::is_empty(sub_interval)) return true; std::pair exterior = container.equal_range(sub_interval); if(exterior.first == exterior.second) return false; const_iterator last_overlap = prior(exterior.second); if(!(sub_segment.second == exterior.first->second) ) return false; return icl::contains(hull(exterior.first->first, last_overlap->first), sub_interval) && Interval_Map::is_joinable(container, exterior.first, last_overlap); } template bool contains(const IntervalMapT& super, const IntervalMapT& sub) { return Interval_Set::within(sub, super); } } // namespace Interval_Map }} // namespace icl boost #endif