include/Pair.hpp

Go to the documentation of this file.
00001 // Pair.hpp: this file is part of the REGAL project.
00002 //
00003 // REGAL : Random and Exhaustive Generators for Automata - Library
00004 //
00005 // Copyright (C) 2007 Julien DAVID.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 //
00016 #ifndef PAIR_HPP
00017 #define PAIR_HPP
00018 
00019 namespace regal{
00020 
00021   template<typename elt1,typename elt2>
00022   class Pair{
00023   public:
00024     elt1 first;
00025     elt2 second;
00026     
00027     friend bool operator==(Pair<elt1,elt2> p1,Pair<elt1,elt2> p2){
00028       if(p1.first==p2.first&&p1.second==p2.second)
00029         return true;
00030       return false;
00031     }
00032 
00033     friend bool operator<(Pair<elt1,elt2> p1,Pair<elt1,elt2> p2){
00034       if(p1.first<p2.first||(p1.first==p2.first&&p1.second<p2.second))
00035         return true;
00036       return false;
00037     }
00038   
00039     Pair(const elt1 & f=0){
00040       first=f;
00041       second=f;
00042     }
00043     
00044     Pair(const elt1 & f,const elt2 & s){
00045       first=f;
00046       second=s;
00047     }
00048     
00049     Pair(const Pair<elt1,elt2> & p){
00050       first=p.first;
00051       second=p.second;
00052     }
00053     
00054     ~Pair(){};
00055     
00056   };
00057   
00064   ostream& operator<<(ostream& o,const Pair<int,int> & a){
00065     o<<"("<<a.first<<", "<<a.second<<")";
00066     return o;
00067   }
00068 
00069 
00070 
00071 }
00072 
00073 #endif 

Generated on Mon Sep 29 16:33:58 2008 for REGAL by  doxygen 1.5.1