~pac72/ubuntu/lucid/ddd/devel

« back to all changes in this revision

Viewing changes to ddd/Assoc.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Schepler
  • Date: 2004-07-22 03:49:37 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040722034937-cysl08t1jvba4jrx
Tags: 1:3.3.9-3
USERINFO has been renamed to USERINFO.txt; adjust debian/rules code
to match, to get correct information on the About DDD dialog.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// $Id: Assoc.h,v 1.19 2000/05/29 14:07:20 andreas Exp $
 
1
// $Id$
2
2
// Associative array
3
3
 
4
4
// Copyright (C) 1995-1998 Technische Universitaet Braunschweig, Germany.
29
29
#ifndef _DDD_Assoc_h
30
30
#define _DDD_Assoc_h
31
31
 
32
 
#if defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 5)
33
 
#pragma interface
34
 
#endif
35
 
 
36
32
#include "bool.h"
37
33
#include "assert.h"
38
34
 
65
61
    {}
66
62
 
67
63
private:
68
 
    AssocRec(const AssocRec<K, V>& x)
69
 
        : next(0), key(x.key), value(x.value)
70
 
    {
71
 
        assert(0);
72
 
    }
73
 
    AssocRec<K,V>& operator = (const AssocRec<K, V>&)
74
 
    {
75
 
        assert(0); return *this;
76
 
    }
 
64
    AssocRec(const AssocRec<K, V>&);
 
65
    AssocRec<K,V>& operator = (const AssocRec<K, V>&);
77
66
};
78
67
 
79
68
template<class K, class V>
239
228
    }
240
229
    AssocMark<K,V>& operator = (const AssocMark<K,V>& mark)
241
230
    {
242
 
        rec = mark.rec;
 
231
        if (this != &mark)
 
232
          rec = mark.rec;
243
233
        return *this;
244
234
    }
245
235
};
266
256
    }
267
257
    AssocIter<K,V>& operator = (const AssocIter<K,V>& iter)
268
258
    {
269
 
        AssocMark<K,V>::operator = (iter);
 
259
        if (this != &iter)
 
260
          AssocMark<K,V>::operator = (iter);
270
261
        return *this;
271
262
    }
272
263
 
274
265
    const V& value() const { return this->rec->value; }
275
266
    V& value()             { return this->rec->value; }
276
267
 
277
 
    bool ok() { return this->rec != 0; }
278
 
    AssocIter<K,V> next() { return AssocIter<K,V>(this->rec->next); }
 
268
    bool ok() const { return this->rec != 0; }
 
269
    AssocIter<K,V> next() const { return AssocIter<K,V>(this->rec->next); }
279
270
    const AssocIter<K,V>& operator ++ ()
280
271
    {
281
272
        this->rec = this->rec->next; return *this;
336
327
    // Assignment
337
328
    Assoc<K, V>& operator = (const Assoc<K, V>& m)
338
329
    {
339
 
        _Assoc<K, V>::operator =(m);
 
330
        if (this != &m) {
 
331
          _Assoc<K, V>::operator =(m);
 
332
        }
340
333
        return *this;
341
334
    }
342
335
};