Fern   www.davinpearson.com
New Zealanders making it harder to hate computers

    Main Menu     Research Projects      Photo Album      Curriculum Vitae   Greatest Artists  
  Email Address   Computer Games       Web Design          Java Tutorials         Other Links     
Debugging Macros String Class I Linked List System I Java for C Programmers Naming Convention
String Class II How I use m4 Strings III Symmetrical I/O Linked List System II
Run-Time Type Info Virtual Methods An Array System Science & Religion Submodes
Nested Packages Memory Leaks Garbage Collection Internet & Poverty What is Knowledge?
Limits of Evolution Emacs Additions Function Plotter


int.hh

#ifndef ALREADY_INCLUDED_RCGCS_INT_HH
#define ALREADY_INCLUDED_RCGCS_INT_HH

class Int : public Ref_Count
{
public:
   int v;

private:
   explicit Int(int v) : Ref_Count(DCODE_INT)
   {
      this->v = v;
   }

public:
   ///
   /// NOTE: replacement for a constructor prevents "new Int" from
   /// occurring which might wreck the smart pointer system.
   ///
   static Int* ctor(int v)
   {
      return new Int(v);
   }

   static Int* ctor()
   {
      return new Int(0);
   }

   friend bool operator == (const Int& i1, const Int& i2)
   {
      if ((&i1 == null) && (&i2 == null)) {
         return true;
      } else if ((&i1 == null) || (&i2 == null)) {
         return false;
      } else {
         return i1.v == i2.v;
      }
   }

   ///
   /// NOTE: apologies for the non-standard I/O system here:
   ///
   friend Writer& operator << (Writer& w, const Int& i)
   {
      w << i.v;
      return w;
   }
};

#endif /* ALREADY_INCLUDED_RCGCS_INT_HH */

Back

| Main Menu | Research Projects | Photo Album | Curriculum Vitae | Greatest Artists |
| Email Address | Computer Games | Web Design | Java Tutorials | Other Links |
| Debugging Macros | String Class I | Linked List System I | Java for C Programmers | Naming Convention |
| String Class II | How I use m4 | Strings III | Symmetrical I/O | Linked List System II |
| Run-Time Type Info | Virtual Methods | An Array System | Science & Religion | Submodes |
| Nested Packages | Memory Leaks | Garbage Collection | Internet & Poverty | What is Knowledge? |
| Limits of Evolution | Emacs Additions | Function Plotter |

Please report any broken links to the webperson
Last modified: Wed Jun 13 18:47:31 NZST 2007
© Copyright 1999-2007 Davin Pearson.



Hosted by www.Geocities.ws

1