Skip to content

punch function does not build. #47

@lailoken

Description

@lailoken

I was getting a compile error with:

    using TradeIntervalTree = lib_interval_tree::interval_tree<lib_interval_tree::interval<size_t, lib_interval_tree::right_open>>;
    TradeIntervalTree::interval_type missingRanges;
    std::vector<TradeIntervalTree::interval_type> coveredRanges;
    // ...
    for (auto const& covered : coveredRanges) missingRanges = missingRanges.punch(covered);

Possible fix:

@@ -1353,21 +1353,21 @@ namespace lib_interval_tree
 
             interval_tree result;
             auto i = std::begin(*this);
-            if (ival.low() < i->interval()->low())
-                result.insert({ival.low(), i->interval()->low()});
+            if (ival.low() < i->low())
+                result.insert({ival.low(), i->low()});
 
             for (auto e = end(); i != e; ++i)
             {
                 auto next = i;
                 ++next;
                 if (next != e)
-                    result.insert({i->interval()->high(), next->interval()->low()});
+                    result.insert({i->high(), next->low()});
                 else
                     break;
             }
 
-            if (i != end() && i->interval()->high() < ival.high())
-                result.insert({i->interval()->high(), ival.high()});
+            if (i != end() && i->high() < ival.high())
+                result.insert({i->high(), ival.high()});
 
             return result;
         }

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions