ROSE 0.11.145.192
IntervalSet.h
1// WARNING: Changes to this file must be contributed back to Sawyer or else they will
2// be clobbered by the next update from Sawyer. The Sawyer repository is at
3// https://gitlab.com/charger7534/sawyer.git.
4
5
6
7
8#ifndef Sawyer_IntervalSet_H
9#define Sawyer_IntervalSet_H
10
11#include <Sawyer/IntervalMap.h>
12#include <Sawyer/Optional.h>
13#include <Sawyer/Sawyer.h>
14
15#include <boost/integer_traits.hpp>
16#include <boost/iterator/iterator_facade.hpp>
17
18namespace Sawyer {
19namespace Container {
20
52template<class I>
54 // We use an IntervalMap to do all our work, always storing int(0) as the value.
56 Map map_;
57
58#ifdef SAWYER_HAVE_BOOST_SERIALIZATION
59private:
60 friend class boost::serialization::access;
61
62 template<class S>
63 void serialize(S &s, const unsigned /*version*/) {
64 s & BOOST_SERIALIZATION_NVP(map_);
65 }
66#endif
67
68#ifdef SAWYER_HAVE_CEREAL
69private:
70 friend class cereal::access;
71
72 template<class Archive>
73 void CEREAL_SERIALIZE_FUNCTION_NAME(Archive &archive) {
74 archive(CEREAL_NVP(map_));
75 }
76#endif
77
78
79public:
80 typedef I Interval;
81 typedef typename I::Value Scalar;
87 class ConstIntervalIterator: public boost::iterator_facade<ConstIntervalIterator, const Interval,
88 boost::bidirectional_traversal_tag> {
89 typedef typename IntervalMap<Interval, int>::ConstNodeIterator MapNodeIterator;
90 MapNodeIterator iter_;
91 public:
93 private:
94 friend class boost::iterator_core_access;
95 friend class IntervalSet;
96 explicit ConstIntervalIterator(MapNodeIterator iter): iter_(iter) {}
97 const Interval& dereference() const { return iter_->key(); }
98 bool equal(const ConstIntervalIterator &other) const { return iter_ == other.iter_; }
99 void increment() { ++iter_; }
100 void decrement() { --iter_; }
101 MapNodeIterator base() const { return iter_; }
102 };
103
111 class ConstScalarIterator: public boost::iterator_facade<ConstScalarIterator, const typename Interval::Value,
112 boost::bidirectional_traversal_tag> {
114 typename Interval::Value offset_;
115 mutable typename Interval::Value value_; // so dereference() can return a reference
116 public:
117 ConstScalarIterator(): offset_(0) {}
118 ConstScalarIterator(ConstIntervalIterator iter): iter_(iter), offset_(0) {}
119 private:
120 friend class boost::iterator_core_access;
121 friend class IntervalSet;
122 const typename Interval::Value& dereference() const {
123 ASSERT_require2(iter_->least() <= iter_->greatest(), "stored interval cannot be empty");
124 ASSERT_require(iter_->least() + offset_ <= iter_->greatest());
125 value_ = iter_->least() + offset_;
126 return value_; // must return a reference
127 }
128 bool equal(const ConstScalarIterator &other) const {
129 return iter_ == other.iter_ && offset_ == other.offset_;
130 }
131 void increment() {
132 ASSERT_require2(iter_->least() <= iter_->greatest(), "stored interval cannot be empty");
133 if (iter_->least() + offset_ == iter_->greatest()) {
134 ++iter_;
135 offset_ = 0;
136 } else {
137 ++offset_;
138 }
139 }
140 void decrement() {
141 ASSERT_require2(iter_->least() <= iter_->greatest(), "stored interval cannot be empty");
142 if (0==offset_) {
143 --iter_;
144 offset_ = width(*iter_);
145 } else {
146 --offset_;
147 }
148 }
149 };
150
152 // Constructors
154
159
163 template<class Interval2>
165 typedef typename IntervalSet<Interval2>::ConstIntervalIterator OtherIntervalIterator;
166 for (OtherIntervalIterator otherIter=other.intervals().begin(); otherIter!=other.intervals().end(); ++otherIter)
167 insert(*otherIter);
168 }
169
174 template<class Interval2, class T, class Policy>
176 typedef typename IntervalMap<Interval2, T, Policy>::ConstNodeIterator OtherNodeIterator;
177 for (OtherNodeIterator otherIter=other.nodes().begin(); otherIter!=other.nodes().end(); ++otherIter)
178 insert(otherIter->key());
179 }
180
185 template<class Iterator>
186 IntervalSet(const boost::iterator_range<Iterator> &intervals) {
187 for (Iterator iter=intervals.begin(); iter!=intervals.end(); ++iter)
188 insert(*iter);
189 }
190
195 template<class Interval2>
197 clear();
198 typedef typename IntervalSet<Interval2>::ConstIntervalIterator OtherIntervalIterator;
199 for (OtherIntervalIterator otherIter=other.intervals().begin(); otherIter!=other.intervals().end(); ++otherIter)
200 insert(*otherIter);
201 return *this;
202 }
203
210 template<class Interval2, class T, class Policy>
212 clear();
213 typedef typename IntervalMap<Interval2, T, Policy>::ConstNodeIterator OtherNodeIterator;
214 for (OtherNodeIterator otherIter=other.nodes().begin(); otherIter!=other.nodes().end(); ++otherIter)
215 insert(otherIter->key());
216 return *this;
217 }
218
223 template<class Iterator>
224 IntervalSet& operator=(const boost::iterator_range<Iterator> &intervals) {
225 clear();
226 for (Iterator iter=intervals.begin(); iter!=intervals.end(); ++iter)
227 insert(*iter);
228 return *this;
229 }
230
232 // Iteration
234
236 boost::iterator_range<ConstIntervalIterator> intervals() const {
237 return boost::iterator_range<ConstIntervalIterator>(ConstIntervalIterator(map_.nodes().begin()),
238 ConstIntervalIterator(map_.nodes().end()));
239 }
240
242 boost::iterator_range<ConstScalarIterator> scalars() const {
243 return boost::iterator_range<ConstScalarIterator>(ConstScalarIterator(intervals().begin()),
245 }
246
250 ConstIntervalIterator lowerBound(const typename Interval::Value &scalar) const {
251 return ConstIntervalIterator(map_.lowerBound(scalar));
252 }
253
257 ConstIntervalIterator upperBound(const typename Interval::Value &scalar) const {
258 return ConstIntervalIterator(map_.upperBound(scalar));
259 }
260
264 ConstIntervalIterator findPrior(const typename Interval::Value &scalar) const {
265 return ConstIntervalIterator(map_.findPrior(scalar));
266 }
267
271 ConstIntervalIterator find(const typename Interval::Value &scalar) const {
272 return ConstIntervalIterator(map_.find(scalar));
273 }
274
278 boost::iterator_range<ConstIntervalIterator> findAll(const Interval &interval) const {
279 boost::iterator_range<typename Map::ConstNodeIterator> range = map_.findAll(interval);
280 return boost::iterator_range<ConstIntervalIterator>(ConstIntervalIterator(range.begin()),
281 ConstIntervalIterator(range.end()));
282 }
283
287 ConstIntervalIterator findFirstOverlap(const Interval &interval) const {
288 return ConstIntervalIterator(map_.findFirstOverlap(interval));
289 }
290
295 std::pair<ConstIntervalIterator, ConstIntervalIterator>
297 std::pair<typename Map::ConstNodeIterator, typename Map::ConstNodeIterator> found =
298 map_.findFirstOverlap(thisIter.base(), other.map_, otherIter.base());
299 return std::make_pair(ConstIntervalIterator(found.first), ConstIntervalIterator(found.second));
300 }
301
303 // Size
305
309 bool isEmpty() const {
310 return map_.isEmpty();
311 }
312
318 typename Interval::Value size() const {
319 return map_.size();
320 }
321
326 size_t nIntervals() const {
327 return map_.nIntervals();
328 }
329
331 Interval hull() const {
332 return map_.hull();
333 }
334
336 // Predicates
338
344 template<class Interval2>
345 bool overlaps(const Interval2 &interval) const {
346 return map_.isOverlapping(interval);
347 }
348 template<class Interval2>
349 bool isOverlapping(const Interval2 &interval) const {
350 return overlaps(interval);
351 }
352
353 template<class Interval2>
354 bool overlaps(const IntervalSet<Interval2> &other) const {
355 return map_.overlaps(other.map_);
356 }
357 template<class Interval2>
358 bool isOverlapping(const IntervalSet<Interval2> &other) const {
359 return overlaps(other);
360 }
361
362 template<class Interval2, class T2, class Policy2>
364 return map_.overlaps(other);
365 }
366 template<class Interval2, class T2, class Policy2>
368 return overlaps(other);
369 }
377 template<class Interval2>
378 bool isDistinct(const Interval2 &interval) const {
379 return !overlaps(interval);
380 }
381
382 template<class Interval2>
383 bool isDistinct(const IntervalSet<Interval2> &other) const {
384 return !overlaps(other);
385 }
386
387 template<class Interval2, class T2, class Policy2>
389 return !overlaps(other);
390 }
396 bool exists(const typename Interval::Value &scalar) const {
397 return find(scalar)!=intervals().end();
398 }
399
405 bool contains(const typename Interval::Value &scalar) const {
406 return exists(scalar);
407 }
408
409 template<class Interval2>
410 bool contains(const Interval2 &interval) const {
411 return map_.contains(interval);
412 }
413
414 template<class Interval2>
415 bool contains(const IntervalSet<Interval2> &other) const {
416 return map_.contains(other.map_);
417 }
418
419 template<class Interval2, class T2, class Policy2>
421 return map_.contains(other);
422 }
426 // Searching
428
430 Scalar least() const {
431 ASSERT_forbid(isEmpty());
432 return map_.least();
433 }
434
436 Scalar greatest() const {
437 ASSERT_forbid(isEmpty());
438 return map_.greatest();
439 }
440
445 Optional<Scalar> least(Scalar lowerLimit) const {
446 return map_.least(lowerLimit);
447 }
448
453 Optional<Scalar> greatest(Scalar upperLimit) const {
454 return map_.greatest(upperLimit);
455 }
456
462 return map_.leastUnmapped(lowerLimit);
463 }
464
470 return map_.greatestUnmapped(upperLimit);
471 }
472
483 return ConstIntervalIterator(map_.firstFit(size, start.iter_));
484 }
485
497 return ConstIntervalIterator(map_.bestFit(size, start.iter_));
498 }
499
500
501
503 // Modifiers
505
509 void clear() {
510 map_.clear();
511 }
512
516 void invert() {
518 }
519
523 void invert(const Interval &restricted) {
524 IntervalSet inverted;
525 if (!restricted.isEmpty()) {
526 typename Interval::Value pending = restricted.least();
527 bool insertTop = true;
528 for (typename Map::ConstIntervalIterator iter=map_.lowerBound(restricted.least());
529 iter!=map_.intervals().end(); ++iter) {
530 if (iter->least() > restricted.greatest())
531 break;
532 if (pending < iter->least())
533 inverted.insert(Interval::hull(pending, iter->least()-1));
534 if (iter->greatest() < restricted.greatest()) {
535 pending = iter->greatest() + 1;
536 } else {
537 insertTop = false;
538 break;
539 }
540 }
541 if (insertTop)
542 inverted.insert(Interval::hull(pending, restricted.greatest()));
543 }
544 std::swap(map_, inverted.map_);
545 }
546
553 template<class Interval2>
554 void insert(const Interval2 &interval) {
555 map_.insert(interval, 0);
556 }
557
558 template<class Interval2>
560 typedef typename IntervalSet<Interval2>::ConstIntervalIterator OtherIterator;
561 for (OtherIterator otherIter=other.intervals().begin(); otherIter!=other.intervals().end(); ++otherIter)
562 map_.insert(*otherIter, 0);
563 }
564
565 template<class Interval2, class T, class Policy>
568 for (OtherIterator otherIter=other.intervals().begin(); otherIter!=other.intervals().end(); ++otherIter)
569 map_.insert(*otherIter, 0);
570 }
579 template<class Interval2>
580 void erase(const Interval2 &interval) {
581 map_.erase(interval);
582 }
583
584 template<class Interval2>
586 ASSERT_forbid2((void*)&other==(void*)this, "use IntervalSet::clear() instead");
587 typedef typename IntervalSet<Interval2>::ConstIntervalIterator OtherIntervalIterator;
588 for (OtherIntervalIterator otherIter=other.intervals().begin(); otherIter!=other.intervals().end(); ++otherIter)
589 map_.erase(*otherIter);
590 }
591
592 template<class Interval2, class T, class Policy>
594 typedef typename IntervalMap<Interval2, T, Policy>::ConstIntervalIterator OtherIntervalIterator;
595 for (OtherIntervalIterator otherIter=other.intervals().begin(); otherIter!=other.intervals().end(); ++otherIter)
596 map_.erase(otherIter->first);
597 }
607 template<class Interval2>
608 void intersect(const Interval2 &interval) {
609 if (isEmpty())
610 return;
611 if (interval.isEmpty()) {
612 clear();
613 return;
614 }
615 if (hull().least() < interval.least())
616 map_.erase(Interval::hull(hull().least(), interval.least()-1));
617 if (hull() && hull().greatest() > interval.greatest())
618 map_.erase(Interval::hull(interval.greatest(), hull().greatest()));
619 }
620
621 template<class Interval2>
623 other.invert(hull());
624 map_.eraseMultiple(other.map_);
625 }
626
627 template<class Interval2, class T, class Policy>
628 void intersect(const IntervalMap<Interval2, T, Policy> &other);// FIXME[Robb Matzke 2014-04-12]: not implemented yet
632
633 // Operators
635
637 bool operator==(const IntervalSet &other) const {
638 return !(*this!=other);
639 }
640
642 bool operator!=(const IntervalSet &other) const {
643 if (map_.nIntervals()!=other.map_.nIntervals())
644 return true;
645 for (ConstIntervalIterator ai=intervals().begin(), bi=other.intervals().begin(); ai!=intervals().end(); ++ai, ++bi) {
646 if (*ai!=*bi)
647 return true;
648 }
649 return false;
650 }
651
654 IntervalSet tmp = *this;
655 tmp.invert();
656 return tmp;
657 }
658
665 insertMultiple(other);
666 return *this;
667 }
668
670 insertMultiple(other);
671 return *this;
672 }
680 IntervalSet& operator|=(const Interval &interval) {
681 insert(interval);
682 return *this;
683 }
684
685 IntervalSet& operator+=(const Interval &interval) {
686 insert(interval);
687 return *this;
688 }
694 IntervalSet operator|(const IntervalSet &other) const {
695 if (nIntervals() < other.nIntervals()) {
696 IntervalSet tmp = other;
697 tmp.insertMultiple(*this);
698 return tmp;
699 }
700 IntervalSet tmp = *this;
701 tmp.insertMultiple(other);
702 return tmp;
703 }
704
705 IntervalSet operator+(const IntervalSet &other) const {
706 return *this | other;
707 }
715 IntervalSet operator|(const Interval &interval) const {
716 IntervalSet retval = *this;
717 retval.insert(interval);
718 return retval;
719 }
720
721 IntervalSet operator+(const Interval &interval) const {
722 return *this | interval;
723 }
730 intersect(other);
731 return *this;
732 }
733
737 IntervalSet& operator&=(const Interval &interval) {
738 intersect(interval);
739 return *this;
740 }
741
743 IntervalSet operator&(const IntervalSet &other) const {
744 if (nIntervals() < other.nIntervals()) {
745 IntervalSet tmp = other;
746 tmp.intersect(*this);
747 return tmp;
748 }
749 IntervalSet tmp = *this;
750 tmp.intersect(other);
751 return tmp;
752 }
753
755 IntervalSet operator&(const Interval &interval) const {
756 IntervalSet retval = *this;
757 retval.intersect(interval);
758 return retval;
759 }
760
765 eraseMultiple(other);
766 return *this;
767 }
768
772 IntervalSet& operator-=(const Interval &interval) {
773 erase(interval);
774 return *this;
775 }
776
780 IntervalSet operator-(const IntervalSet &other) const {
781 IntervalSet tmp = *this;
782 tmp.eraseMultiple(other);
783 return tmp;
784 }
785
787 IntervalSet operator-(const Interval &interval) const {
788 IntervalSet tmp = *this;
789 tmp.erase(interval);
790 return tmp;
791 }
792};
793
794} // namespace
795} // namespace
796
797#endif
An associative container whose keys are non-overlapping intervals.
size_t nIntervals() const
Number of nodes in the container.
void insert(Interval key, Value value, bool makeHole=true)
Insert a key/value pair.
void clear()
Empties the container.
Interval::Value greatest() const
Returns the maximum scalar key.
void eraseMultiple(const IntervalMap< Interval, T2, Policy2 > &other)
Erase intervals specified in another IntervalMap.
Interval hull() const
Returns the range of values in this map.
NodeIterator upperBound(const typename Interval::Value &scalar)
Find the first node whose interval begins above the specified scalar key.
boost::iterator_range< NodeIterator > nodes()
Iterators for traversing nodes.
Interval::Value least() const
Returns the minimum scalar key.
NodeIterator firstFit(const typename Interval::Value &size, NodeIterator start)
Find the first fit node at or after a starting point.
void erase(const Interval &erasure)
Erase the specified interval.
NodeIterator lowerBound(const typename Interval::Value &scalar)
Find the first node whose interval ends at or above the specified scalar key.
NodeIterator find(const typename Interval::Value &scalar)
Find the node containing the specified scalar key.
boost::iterator_range< ConstIntervalIterator > intervals() const
Iterators for traversing keys.
boost::iterator_range< NodeIterator > findAll(const Interval &interval)
Finds all nodes overlapping the specified interval.
NodeIterator findPrior(const typename Interval::Value &scalar)
Find the last node whose interval starts at or below the specified scalar key.
NodeIterator findFirstOverlap(const Interval &interval)
Find first interval that overlaps with the specified interval.
Optional< typename Interval::Value > greatestUnmapped(typename Interval::Value upperLimit) const
Returns the limited-maximum unmapped scalar key.
bool isEmpty() const
Determine if the container is empty.
Interval::Value size() const
Returns the number of values represented by this container.
Optional< typename Interval::Value > leastUnmapped(typename Interval::Value lowerLimit) const
Returns the limited-minimum unmapped scalar key.
NodeIterator bestFit(const typename Interval::Value &size, NodeIterator start)
Find the best fit node at or after a starting point.
A container holding a set of values.
Definition IntervalSet.h:53
bool isOverlapping(const IntervalSet< Interval2 > &other) const
Determines whether this set overlaps with the argument.
ConstIntervalIterator bestFit(const typename Interval::Value &size, ConstIntervalIterator start) const
Find the best fit node at or after a starting point.
bool isDistinct(const IntervalSet< Interval2 > &other) const
Determines whether this set is distinct from the argument.
IntervalSet & operator+=(const IntervalSet &other)
In-place union.
IntervalSet operator-(const IntervalSet &other) const
Subtract another set from this one.
void erase(const Interval2 &interval)
Remove specified values.
ConstIntervalIterator upperBound(const typename Interval::Value &scalar) const
Find the first node whose interval begins above the specified scalar key.
IntervalSet & operator|=(const Interval &interval)
In-place union with interval.
bool overlaps(const IntervalMap< Interval2, T2, Policy2 > &other) const
Determines whether this set overlaps with the argument.
bool exists(const typename Interval::Value &scalar) const
Determines if a value exists in the set.
ConstIntervalIterator findFirstOverlap(const Interval &interval) const
Finds first node that overlaps with the specified interval.
void eraseMultiple(const IntervalMap< Interval2, T, Policy > &other)
Remove specified values.
IntervalSet & operator|=(const IntervalSet &other)
In-place union.
bool operator!=(const IntervalSet &other) const
Determines if two sets contain different elements.
IntervalSet(const boost::iterator_range< Iterator > &intervals)
Construct from an iterator range.
ConstIntervalIterator findPrior(const typename Interval::Value &scalar) const
Find the last node whose interval starts at or below the specified scalar key.
Optional< Scalar > least(Scalar lowerLimit) const
Returns the limited-minimum scalar contained in this set.
Optional< Scalar > greatest(Scalar upperLimit) const
Returns the limited-maximum scalar contained in this set.
boost::iterator_range< ConstScalarIterator > scalars() const
Iterator range for all scalar values logically represented by this set.
bool contains(const IntervalSet< Interval2 > &other) const
Determines whether this set fully contains the argument.
void intersect(const IntervalMap< Interval2, T, Policy > &other)
Interset with specified values.
IntervalSet operator~() const
Return inverse of specified set.
Optional< Scalar > greatestNonExistent(Scalar upperLimit) const
Returns the limited-maximum scalar not contained in this set.
Interval hull() const
Returns the range of values in this map.
boost::iterator_range< ConstIntervalIterator > findAll(const Interval &interval) const
Finds all nodes overlapping the specified interval.
bool contains(const typename Interval::Value &scalar) const
Determines whether this set fully contains the argument.
IntervalSet()
Default constructor.
void eraseMultiple(const IntervalSet< Interval2 > &other)
Remove specified values.
IntervalSet(const IntervalSet< Interval2 > &other)
Copy constructor.
IntervalSet & operator+=(const Interval &interval)
In-place union with interval.
IntervalSet operator&(const Interval &interval) const
Intersection of set with interval.
ConstIntervalIterator firstFit(const typename Interval::Value &size, ConstIntervalIterator start) const
Find the first fit node at or after a starting point.
void insertMultiple(const IntervalMap< Interval2, T, Policy > &other)
Insert specified values.
Interval::Value size() const
Number of scalar elements represented.
bool overlaps(const IntervalSet< Interval2 > &other) const
Determines whether this set overlaps with the argument.
ConstIntervalIterator lowerBound(const typename Interval::Value &scalar) const
Find the first node whose interval ends at or above the specified scalar key.
bool isOverlapping(const IntervalMap< Interval2, T2, Policy2 > &other) const
Determines whether this set overlaps with the argument.
size_t nIntervals() const
Number of storage nodes.
bool operator==(const IntervalSet &other) const
Determines if two sets contain the same elements.
bool overlaps(const Interval2 &interval) const
Determines whether this set overlaps with the argument.
void intersect(IntervalSet< Interval2 > other)
Interset with specified values.
void insert(const Interval2 &interval)
Insert specified values.
IntervalSet operator&(const IntervalSet &other) const
Intersection of two sets.
bool isEmpty() const
Determine whether the container is empty.
IntervalSet operator+(const IntervalSet &other) const
Union of two sets.
IntervalSet operator|(const Interval &interval) const
Union of set with interval.
Scalar least() const
Returns the minimum scalar contained in this set.
void clear()
Remove all values.
bool contains(const Interval2 &interval) const
Determines whether this set fully contains the argument.
bool isDistinct(const Interval2 &interval) const
Determines whether this set is distinct from the argument.
IntervalSet operator+(const Interval &interval) const
Union of set with interval.
bool contains(const IntervalMap< Interval2, T2, Policy2 > &other) const
Determines whether this set fully contains the argument.
Optional< Scalar > leastNonExistent(Scalar lowerLimit) const
Returns the limited-minimum scalar not contained in this set.
IntervalSet & operator=(const IntervalSet< Interval2 > &other)
Assignment from another set.
Scalar greatest() const
Returns the maximum scalar contained in this set.
bool isDistinct(const IntervalMap< Interval2, T2, Policy2 > &other) const
Determines whether this set is distinct from the argument.
IntervalSet operator-(const Interval &interval) const
Subtract an interval from this set.
boost::iterator_range< ConstIntervalIterator > intervals() const
Iterator range for all intervals actually stored by this set.
void invert(const Interval &restricted)
Invert and intersect.
IntervalSet & operator-=(const Interval &interval)
In-place subtraction of an interval.
void insertMultiple(const IntervalSet< Interval2 > &other)
Insert specified values.
IntervalSet & operator&=(const Interval &interval)
In-place intersection with an interval.
IntervalSet & operator-=(const IntervalSet &other)
In-place subtraction.
IntervalSet operator|(const IntervalSet &other) const
Union of two sets.
IntervalSet & operator=(const boost::iterator_range< Iterator > &intervals)
Assignment from an iterator range.
IntervalSet & operator&=(const IntervalSet &other)
In-place intersection.
ConstIntervalIterator find(const typename Interval::Value &scalar) const
Find the node containing the specified scalar key.
bool isOverlapping(const Interval2 &interval) const
Determines whether this set overlaps with the argument.
std::pair< ConstIntervalIterator, ConstIntervalIterator > findFirstOverlap(ConstIntervalIterator thisIter, const IntervalSet &other, ConstIntervalIterator otherIter) const
Find first nodes that overlap.
IntervalSet & operator=(const IntervalMap< Interval2, T, Policy > &other)
Assignment from an IntervalMap.
void intersect(const Interval2 &interval)
Interset with specified values.
I::Value Scalar
Type of scalar values stored in this set.
Definition IntervalSet.h:81
IntervalSet(const IntervalMap< Interval2, T, Policy > &other)
Construct from an IntervalMap.
static Interval hull(T v1, T v2)
Construct an interval from two endpoints.
Definition Interval.h:162
T Value
Types of values in the interval.
Definition Interval.h:34
static Interval whole()
Construct an interval that covers the entire domain.
Definition Interval.h:191
Bidirectional iterator over keys.
Definition Sawyer/Map.h:243
Bidirectional iterator over key/value nodes.
Definition Sawyer/Map.h:213
Holds a value or nothing.
Definition Optional.h:56
Sawyer support library.