Code Search for Developers
 
 
  

Int2.h from Magnus at Krugle


Show Int2.h syntax highlighted

// Copyright (C) 1994 The New York Group Theory Cooperative
// See magnus/doc/COPYRIGHT for the full notice.

// Contents: Definition and implementation of class Int2
//
// Principal Author: Dmitry Bormotov
//
// Status: temporary
//
// Revision History:


#ifndef _Int2_H_
#define _Int2_H_


#include "global.h"


struct Int2 {

  Int2( ) : v(0) { }

  Int2( int x ) : v(x) { }

  int compare( Int2 x ) const {
    if( this->v < x.v ) return -1;
    else if( this->v > x.v ) return 1;
    else return 0;
  }

  friend ostream& operator << ( ostream& ostr, const Int2& i )
  {
    ostr << i.v;
    return ostr;
  }

  bool operator == ( const Int2& i ) const { return v == i.v; }

  bool operator != ( const Int2& i ) const { return !(*this == i); }

  Int2 operator - ( ) const { return -v; }

  Int2 operator + ( const Int2& i ) const { return v + i.v; }

  Int2& operator += ( const Int2& i ) { v += i.v; return *this; }

  Int2 operator * ( const Int2& i ) const { return v * i.v; }

  Int2& operator *= ( const Int2& i ) { v *= i.v; return *this; }

  bool operator < ( const Int2& i ) const { return v < i.v; }

  bool operator > ( const Int2& i ) const { return v > i.v; }

  int value( ) const { return v; }

private:

  int v;
};

#endif




See more files for this project here

Magnus

Magnus is a special purpose mathematical package for Infinite Group Theory computations

Project homepage: http://sourceforge.net/projects/magnus
Programming language(s): C,C++
License: other

  Associations.h
  BTree.h
  BlackBox.h
  Cell.h
  Chars.h
  DArray.h
  DCell.h
  DList.h
  File.h
  GCD.h
  GlobalRandom.h
  IStreamPoll.h
  Int2.h
  List.h
  LogWatcher.h
  MagnusHome.h
  MultiDimArray.h
  QuickAssociations.h
  RandomNumbers.h
  Set.h
  Stack.h
  Timer.h
  Type.h
  Vector.h
  WordParser.h
  conversions.h