From 70789717cfe9ddf4f0b980f740d5ed3e5c3e5e38 Mon Sep 17 00:00:00 2001 From: fred Date: Mon, 28 Oct 1996 23:49:49 +0000 Subject: [PATCH] flower-1.0.3 --- flower/cursor.cc | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/flower/cursor.cc b/flower/cursor.cc index 10e90de919..2a9f885689 100644 --- a/flower/cursor.cc +++ b/flower/cursor.cc @@ -1,10 +1,7 @@ -// cursor.cc #ifndef CURSOR_CC #define CURSOR_CC #include "cursor.hh" -//#define inline -//#include "cursor.inl" #include template @@ -72,4 +69,27 @@ Cursor::operator -( int i ) const return r; } +template +int +Cursor::operator-(Cursor c) const +{ + assert(c.list == list); + int dif = 0; + Cursor upward(c); + while (upward.ok() && upward.pointer_ != pointer_) { + upward++; + dif++; + } + + if (upward.ok()) + return dif; + dif =0; + while (c.ok()&& c.pointer_ != pointer_) { + dif --; + c--; + } + assert(c.ok()); + return dif; +} + #endif -- 2.39.5