This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/4773: Internal Compiler Error when 'template <class U> friend handle<U>;' added to handle class



>Number:         4773
>Category:       c++
>Synopsis:       Internal Compiler Error when 'template <class U> friend handle<U>;' added to handle class
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 02 12:16:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     darco
>Release:        gcc version 2.95.3-5 (cygwin special)
>Organization:
>Environment:
I have been able to reproduce this bug with both the version of GCC that is included with the latest version of Cygwin and RedHat Linux 7.1.
>Description:
I tried to create a template class that was a friend to
every type of that template class. I was not sure if
this was possible or not, but I figured that if it was
the line would look something like this:

template <class U> friend handle<U>;

I added this line to the class, and recompiled. I got an ICE. I was on a Win2K box runinng Cygwin at the time.

I then attempted the build on my RedHat 7.1 linux box, and I recieved yet another ICE.

The command line was as follows:
g++ -v -save-temps -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -c -o main.o main.cpp




The output is as follows:
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs
gcc version 2.95.3-5 (cygwin special)
 /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/cpp0.exe -lang-c++ -v -I. -I. -I.. -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D_X86_=1 -D_X86_=1 -Asystem(winnt) -D__EXCEPTIONS -D__OPTIMIZE__ -g -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D_stdcall=__attribute__((__stdcall__)) -D_cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -isystem /usr/local/include -idirafter /usr/include -idirafter /usr/include/w32api -isystem /usr/include/g++-3 -isystem /usr/include/g++ -DHAVE_CONFIG_H main.cpp main.ii
GNU CPP version 2.95.3-5 (cygwin special) (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 .
 ..
 /usr/local/include
 /usr/include/g++-3
 /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include
 /usr/include
 /usr/include/w32api
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
 /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/cc1plus.exe main.ii -quiet -dumpbase main.cc -g -O2 -version -o main.s
GNU C++ version 2.95.3-5 (cygwin special) (i686-pc-cygwin) compiled by GNU C version 2.95.3-5 (cygwin special).
In file included from main.cpp:15:
handle.h: In instantiation of `handle<fishtank::object::Camera>':
world.h:28:   instantiated from here
handle.h:12: Internal compiler error.
handle.h:12: Please submit a full bug report.
handle.h:12: See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
>How-To-Repeat:
Using the attached file, main.ii, just run:

gcc main.ii

It should ICE.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="main.ii"
Content-Disposition: inline; filename="main.ii"

# 1 "main.cpp"
 





# 1 "../config.h" 1
 
 

 


 


 


 


 
 

 

 
# 7 "main.cpp" 2

# 1 "/usr/include/g++-3/iostream" 1 3
 
 



# 1 "/usr/include/g++-3/iostream.h" 1 3
 

























#pragma interface



# 1 "/usr/include/g++-3/streambuf.h" 1 3
 


























#pragma interface


   



extern "C" {
# 1 "/usr/include/g++-3/libio.h" 1 3
 




























# 1 "/usr/include/_G_config.h" 1 3
  









typedef          int   _G_int8_t __attribute__((__mode__(__QI__)));
typedef unsigned int  _G_uint8_t __attribute__((__mode__(__QI__)));
typedef          int  _G_int16_t __attribute__((__mode__(__HI__)));
typedef unsigned int _G_uint16_t __attribute__((__mode__(__HI__)));
typedef          int  _G_int32_t __attribute__((__mode__(__SI__)));
typedef unsigned int _G_uint32_t __attribute__((__mode__(__SI__)));
typedef          int  _G_int64_t __attribute__((__mode__(__DI__)));
typedef unsigned int _G_uint64_t __attribute__((__mode__(__DI__)));

__extension__ typedef long long _G_llong;
__extension__ typedef unsigned long long _G_ullong;








typedef unsigned long _G_clock_t;
typedef short _G_dev_t;
typedef long _G_fpos_t;
typedef unsigned short _G_gid_t;
typedef unsigned long _G_ino_t;
typedef int _G_mode_t;
typedef unsigned short _G_nlink_t;
typedef long _G_off_t;
typedef int _G_pid_t;



typedef int _G_ptrdiff_t;
typedef unsigned long _G_sigset_t;



typedef unsigned int _G_size_t;
typedef long _G_time_t;
typedef unsigned short _G_uid_t;
typedef short unsigned int _G_wchar_t;















typedef long _G_ssize_t;
typedef unsigned int _G_wint_t;
typedef void * _G_va_list;

















# 1 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 1 3








 


# 21 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3



 


 





 


# 63 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3


 





 


















 





 

 

# 133 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3


 

 

# 192 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3



 




 

# 273 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3


# 285 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3


 

 

# 319 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3




 






















# 86 "/usr/include/_G_config.h" 2 3


# 30 "/usr/include/g++-3/libio.h" 2 3

















# 55 "/usr/include/g++-3/libio.h" 3




# 1 "/usr/include/sys/cdefs.h" 1 3
 





















# 59 "/usr/include/g++-3/libio.h" 2 3


















 















# 104 "/usr/include/g++-3/libio.h" 3











 

























 



















struct _IO_jump_t;  struct _IO_FILE;

 
# 175 "/usr/include/g++-3/libio.h" 3









    typedef void _IO_lock_t;





 

struct _IO_marker {
  struct _IO_marker *_next;
  struct _IO_FILE *_sbuf;
   

   
  int _pos;
# 208 "/usr/include/g++-3/libio.h" 3

};

struct _IO_FILE {
  int _flags;		 


   
   
  char* _IO_read_ptr;	 
  char* _IO_read_end;	 
  char* _IO_read_base;	 
  char* _IO_write_base;	 
  char* _IO_write_ptr;	 
  char* _IO_write_end;	 
  char* _IO_buf_base;	 
  char* _IO_buf_end;	 
   
  char *_IO_save_base;  
  char *_IO_backup_base;   
  char *_IO_save_end;  

  struct _IO_marker *_markers;

  struct _IO_FILE *_chain;

  int _fileno;
  int _blksize;



  _G_off_t  _offset;



   
  unsigned short _cur_column;
  char _unused;
  char _shortbuf[1];

   








};











struct _IO_FILE_plus;
extern struct _IO_FILE_plus _IO_stdin_, _IO_stdout_, _IO_stderr_;





 
typedef struct
{
  _G_ssize_t  (*read)  (struct _IO_FILE *, void *, _G_ssize_t )  ;
  _G_ssize_t  (*write)  (struct _IO_FILE *, const void *, _G_ssize_t )  ;
  _G_off_t  (*seek)  (struct _IO_FILE *, _G_off_t , int)  ;
  int (*close)  (struct _IO_FILE *)  ;
} _IO_cookie_io_functions_t;

 
struct _IO_cookie_file
{
  struct _IO_FILE file;
  const void *vtable;
  void *cookie;
  _IO_cookie_io_functions_t io_functions;
};



extern "C" {


extern int __underflow  (_IO_FILE *)  ;
extern int __uflow  (_IO_FILE *)  ;
extern int __overflow  (_IO_FILE *, int)  ;

















extern int _IO_getc  (_IO_FILE *__fp)  ;
extern int _IO_putc  (int __c, _IO_FILE *__fp)  ;
extern int _IO_feof  (_IO_FILE *__fp)  ;
extern int _IO_ferror  (_IO_FILE *__fp)  ;

extern int _IO_peekc_locked  (_IO_FILE *__fp)  ;

 



extern void _IO_flockfile  (_IO_FILE *)  ;
extern void _IO_funlockfile  (_IO_FILE *)  ;
extern int _IO_ftrylockfile  (_IO_FILE *)  ;













extern int _IO_vfscanf  (_IO_FILE *, const char *, _G_va_list , int *)  ;
extern int _IO_vfprintf  (_IO_FILE *, const char *, _G_va_list )  ;
extern _G_ssize_t  _IO_padn  (_IO_FILE *, int, _G_ssize_t )  ;
extern _G_size_t  _IO_sgetn  (_IO_FILE *, void *, _G_size_t )  ;





extern _G_off_t  _IO_seekoff  (_IO_FILE *, _G_off_t , int, int)  ;
extern _G_off_t  _IO_seekpos  (_IO_FILE *, _G_off_t , int)  ;


extern void _IO_free_backup_area  (_IO_FILE *)  ;


}



# 36 "/usr/include/g++-3/streambuf.h" 2 3

}
 


























extern "C++" {
class istream;  
class ostream; class streambuf;

 







typedef _G_off_t  streamoff;
typedef _G_off_t  streampos;

typedef _G_ssize_t  streamsize;

typedef unsigned long __fmtflags;
typedef unsigned char __iostate;

struct _ios_fields
{  
    streambuf *_strbuf;
    ostream* _tie;
    int _width;
    __fmtflags _flags;
    short  _fill;
    __iostate _state;
    __iostate _exceptions;
    int _precision;

    void *_arrays;  
};















# 124 "/usr/include/g++-3/streambuf.h" 3


class ios : public _ios_fields {
  ios& operator=(ios&);   
  ios (const ios&);  
  public:
    typedef __fmtflags fmtflags;
    typedef int iostate;
    typedef int openmode;
    typedef _G_ssize_t  streamsize;
    enum io_state {
	goodbit = 0 ,
	eofbit = 1 ,
	failbit = 2 ,
	badbit = 4  };
    enum open_mode {
	in = 1 ,
	out = 2 ,
	ate = 4 ,
	app = 8 ,
	trunc = 16 ,
	nocreate = 32 ,
	noreplace = 64 ,
	bin = 128 ,  
	binary = 128  };
    enum seek_dir { beg, cur, end};
    typedef enum seek_dir seekdir;
     
    enum { skipws= 01 ,
	   left= 02 , right= 04 , internal= 010 ,
	   dec= 020 , oct= 040 , hex= 0100 ,
	   showbase= 0200 , showpoint= 0400 ,
	   uppercase= 01000 , showpos= 02000 ,
	   scientific= 04000 , fixed= 010000 ,
	   unitbuf= 020000 , stdio= 040000 



	   };
    enum {  
	basefield=dec+oct+hex,
	floatfield = scientific+fixed,
	adjustfield = left+right+internal
    };

# 177 "/usr/include/g++-3/streambuf.h" 3


    ostream* tie() const { return _tie; }
    ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }

     
    short  fill() const { return _fill; }
    short  fill(short  newf)
	{short  oldf = _fill; _fill = newf; return oldf;}
    fmtflags flags() const { return _flags; }
    fmtflags flags(fmtflags new_val) {
	fmtflags old_val = _flags; _flags = new_val; return old_val; }
    int precision() const { return _precision; }
    int precision(int newp) {
	unsigned short oldp = _precision; _precision = (unsigned short)newp;
	return oldp; }
    fmtflags setf(fmtflags val) {
	fmtflags oldbits = _flags;
	_flags |= val; return oldbits; }
    fmtflags setf(fmtflags val, fmtflags mask) {
	fmtflags oldbits = _flags;
	_flags = (_flags & ~mask) | (val & mask); return oldbits; }
    fmtflags unsetf(fmtflags mask) {
	fmtflags oldbits = _flags;
	_flags &= ~mask; return oldbits; }
    int width() const { return _width; }
    int width(int val) { int save = _width; _width = val; return save; }




    void _throw_failure() const { }

    void clear(iostate state = 0) {
	_state = _strbuf ? state : state|badbit;
	if (_state & _exceptions) _throw_failure(); }
    void set(iostate flag) { _state |= flag;
	if (_state & _exceptions) _throw_failure(); }
    void setstate(iostate flag) { _state |= flag;  
	if (_state & _exceptions) _throw_failure(); }
    int good() const { return _state == 0; }
    int eof() const { return _state & ios::eofbit; }
    int fail() const { return _state & (ios::badbit|ios::failbit); }
    int bad() const { return _state & ios::badbit; }
    iostate rdstate() const { return _state; }
    operator void*() const { return fail() ? (void*)0 : (void*)(-1); }
    int operator!() const { return fail(); }
    iostate exceptions() const { return _exceptions; }
    void exceptions(iostate enable) {
	_exceptions = enable;
	if (_state & _exceptions) _throw_failure(); }

    streambuf* rdbuf() const { return _strbuf; }
    streambuf* rdbuf(streambuf *_s) {
      streambuf *_old = _strbuf; _strbuf = _s; clear (); return _old; }

    static int sync_with_stdio(int on);
    static void sync_with_stdio() { sync_with_stdio(1); }
    static fmtflags bitalloc();
    static int xalloc();
    void*& pword(int);
    void* pword(int) const;
    long& iword(int);
    long iword(int) const;









     
    class Init {
    public:
      Init () { }
    };

  protected:
    inline ios(streambuf* sb = 0, ostream* tie_to = 0);
    inline virtual ~ios();
    inline void init(streambuf* sb, ostream* tie = 0);
};




typedef ios::seek_dir _seek_dir;


 
 
 
 
 

 
 
class streammarker : private _IO_marker {
    friend class streambuf;
    void set_offset(int offset) { _pos = offset; }
  public:
    streammarker(streambuf *sb);
    ~streammarker();
    int saving() { return  1; }
    int delta(streammarker&);
    int delta();
};

struct streambuf : public _IO_FILE {  
    friend class ios;
    friend class istream;
    friend class ostream;
    friend class streammarker;
    const void *&_vtable() { return *(const void**)((_IO_FILE*)this + 1); }
  protected:
    static streambuf* _list_all;  
    _IO_FILE*& xchain() { return _chain; }
    void _un_link();
    void _link_in();
    char* gptr() const
      { return _flags  & 0x100  ? _IO_save_base : _IO_read_ptr; }
    char* pptr() const { return _IO_write_ptr; }
    char* egptr() const
      { return _flags  & 0x100  ? _IO_save_end : _IO_read_end; }
    char* epptr() const { return _IO_write_end; }
    char* pbase() const { return _IO_write_base; }
    char* eback() const
      { return _flags  & 0x100  ? _IO_save_base : _IO_read_base;}
    char* base() const { return _IO_buf_base; }
    char* ebuf() const { return _IO_buf_end; }
    int blen() const { return _IO_buf_end - _IO_buf_base; }
    void xput_char(char c) { *_IO_write_ptr++ = c; }
    int xflags() { return _flags ; }
    int xflags(int f) {int fl = _flags ; _flags  = f; return fl;}
    void xsetflags(int f) { _flags  |= f; }
    void xsetflags(int f, int mask)
      { _flags  = (_flags  & ~mask) | (f & mask); }
    void gbump(int n)
      { _flags  & 0x100  ? (_IO_save_base+=n):(_IO_read_ptr+=n);}
    void pbump(int n) { _IO_write_ptr += n; }
    void setb(char* b, char* eb, int a=0);
    void setp(char* p, char* ep)
      { _IO_write_base=_IO_write_ptr=p; _IO_write_end=ep; }
    void setg(char* eb, char* g, char *eg) {
      if (_flags  & 0x100 ) _IO_free_backup_area(this); 
      _IO_read_base = eb; _IO_read_ptr = g; _IO_read_end = eg; }
    char *shortbuf() { return _shortbuf; }

    int in_backup() { return _flags & 0x100 ; }
     
    char *Gbase() { return in_backup() ? _IO_save_base : _IO_read_base; }
     
    char *eGptr() { return in_backup() ? _IO_save_end : _IO_read_end; }
     
    char *Bbase() { return in_backup() ? _IO_read_base : _IO_save_base; }
    char *Bptr() { return _IO_backup_base; }
     
    char *eBptr() { return in_backup() ? _IO_read_end : _IO_save_end; }
    char *Nbase() { return _IO_save_base; }
    char *eNptr() { return _IO_save_end; }
    int have_backup() { return _IO_save_base != __null ; }
    int have_markers() { return _markers != __null ; }
    void free_backup_area();
    void unsave_markers();  
    int put_mode() { return _flags & 0x800 ; }
    int switch_to_get_mode();
    
    streambuf(int flags=0);
  public:
    static int flush_all();
    static void flush_all_linebuffered();  
    virtual ~streambuf();
    virtual int overflow(int c = (-1) );  
    virtual int underflow();  
    virtual int uflow();  
    virtual int pbackfail(int c);
 
    virtual streamsize xsputn(const char* s, streamsize n);
    virtual streamsize xsgetn(char* s, streamsize n);
    virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
    virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out);

    streampos pubseekoff(streamoff o, _seek_dir d, int mode=ios::in|ios::out)
      { return _IO_seekoff (this, o, d, mode); }
    streampos pubseekpos(streampos pos, int mode = ios::in|ios::out)
      { return _IO_seekpos (this, pos, mode); }
    streampos sseekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
    streampos sseekpos(streampos pos, int mode = ios::in|ios::out);
    virtual streambuf* setbuf(char* p, int len);
    virtual int sync();
    virtual int doallocate();

    int seekmark(streammarker& mark, int delta = 0);
    int sputbackc(char c);
    int sungetc();
    int unbuffered() { return _flags & 2  ? 1 : 0; }
    int linebuffered() { return _flags & 0x200  ? 1 : 0; }
    void unbuffered(int i)
	{ if (i) _flags |= 2 ; else _flags &= ~2 ; }
    void linebuffered(int i)
	{ if (i) _flags |= 0x200 ; else _flags &= ~0x200 ; }
    int allocate() {  
	if (base() || unbuffered()) return 0;
	else return doallocate(); }
     
    void allocbuf() { if (base() == __null ) doallocbuf(); }
    void doallocbuf();
    int in_avail() { return _IO_read_end - _IO_read_ptr; }
    int out_waiting() { return _IO_write_ptr - _IO_write_base; }
    streamsize sputn(const char* s, streamsize n) { return xsputn(s, n); }
    streamsize padn(char pad, streamsize n) { return _IO_padn(this, pad, n); }
    streamsize sgetn(char* s, streamsize n) { return _IO_sgetn(this, s, n); }
    int ignore(int);
    int get_column();
    int set_column(int);
    long sgetline(char* buf, _G_size_t  n, char delim, int putback_delim);
    int sputc(int c) { return _IO_putc(c, this); }
    int sbumpc() { return _IO_getc(this); }
    int sgetc() { return ((  this  )->_IO_read_ptr >= (  this  )->_IO_read_end && __underflow (  this  ) == (-1)  ? (-1)  : *(unsigned char *) (  this  )->_IO_read_ptr)  ; }
    int snextc() {
	if (_IO_read_ptr >= _IO_read_end && __underflow(this) == (-1) )
	  return (-1) ;
	else return _IO_read_ptr++, sgetc(); }
    void stossc() { if (_IO_read_ptr < _IO_read_end) _IO_read_ptr++; }
    int vscan(char const *fmt0, _G_va_list  ap, ios* stream = __null );
    int scan(char const *fmt0 ...);
    int vform(char const *fmt0, _G_va_list  ap);
    int form(char const *fmt0 ...);




    virtual streamsize sys_read(char* buf, streamsize size);
    virtual streamsize sys_write(const char*, streamsize);
    virtual streampos sys_seek(streamoff, _seek_dir);
    virtual int sys_close();
    virtual int sys_stat(void*);  




};

 
 

class filebuf : public streambuf {
  protected:
    void init();
  public:
    static const int openprot;  
    filebuf();
    filebuf(int fd);
    filebuf(int fd, char* p, int len);



    ~filebuf();
    filebuf* attach(int fd);
    filebuf* open(const char *filename, const char *mode);
    filebuf* open(const char *filename, ios::openmode mode, int prot = 0664);
    virtual int underflow();
    virtual int overflow(int c = (-1) );
    int is_open() const { return _fileno >= 0; }
    int fd() const { return is_open() ? _fileno : (-1) ; }
    filebuf* close();
    virtual int doallocate();
    virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
    virtual streambuf* setbuf(char* p, int len);
    streamsize xsputn(const char* s, streamsize n);
    streamsize xsgetn(char* s, streamsize n);
    virtual int sync();
  protected:  
 
    int is_reading() { return eback() != egptr(); }
    char* cur_ptr() { return is_reading() ?  gptr() : pptr(); }
     
    char* file_ptr() { return eGptr(); }
     
    virtual streamsize sys_read(char* buf, streamsize size);
    virtual streampos sys_seek(streamoff, _seek_dir);
    virtual streamsize sys_write(const char*, streamsize);
    virtual int sys_stat(void*);  
    virtual int sys_close();




};

inline void ios::init(streambuf* sb, ostream* tie_to) {
		_state = sb ? ios::goodbit : ios::badbit; _exceptions=0;
		_strbuf=sb; _tie = tie_to; _width=0; _fill=' ';

		_flags=ios::skipws|ios::dec;



		_precision=6; _arrays = 0; }

inline ios::ios(streambuf* sb, ostream* tie_to) { init(sb, tie_to); }

inline ios::~ios() {



     
     
    operator delete[] (_arrays);
}
}  

# 31 "/usr/include/g++-3/iostream.h" 2 3


extern "C++" {
class istream; class ostream;
typedef ios& (*__manip)(ios&);
typedef istream& (*__imanip)(istream&);
typedef ostream& (*__omanip)(ostream&);

extern istream& ws(istream& ins);
extern ostream& flush(ostream& outs);
extern ostream& endl(ostream& outs);
extern ostream& ends(ostream& outs);

class ostream : virtual public ios
{
     
    void do_osfx();
  public:
    ostream() { }
    ostream(streambuf* sb, ostream* tied= __null );
    int opfx() {
	if (!good()) return 0;
	else { if (_tie) _tie->flush();  ; return 1;} }
    void osfx() {  ;
		  if (flags() & (ios::unitbuf|ios::stdio))
		      do_osfx(); }
    ostream& flush();
    ostream& put(char c) { _strbuf->sputc(c); return *this; }





    ostream& write(const char *s, streamsize n);
    ostream& write(const unsigned char *s, streamsize n)
      { return write((const char*)s, n);}
    ostream& write(const signed char *s, streamsize n)
      { return write((const char*)s, n);}
    ostream& write(const void *s, streamsize n)
      { return write((const char*)s, n);}
    ostream& seekp(streampos);
    ostream& seekp(streamoff, _seek_dir);
    streampos tellp();
    ostream& form(const char *format ...);
    ostream& vform(const char *format, _G_va_list  args);

    ostream& operator<<(char c);
    ostream& operator<<(unsigned char c) { return (*this) << (char)c; }
    ostream& operator<<(signed char c) { return (*this) << (char)c; }
    ostream& operator<<(const char *s);
    ostream& operator<<(const unsigned char *s)
	{ return (*this) << (const char*)s; }
    ostream& operator<<(const signed char *s)
	{ return (*this) << (const char*)s; }
    ostream& operator<<(const void *p);
    ostream& operator<<(int n);
    ostream& operator<<(unsigned int n);
    ostream& operator<<(long n);
    ostream& operator<<(unsigned long n);

    __extension__ ostream& operator<<(long long n);
    __extension__ ostream& operator<<(unsigned long long n);

    ostream& operator<<(short n) {return operator<<((int)n);}
    ostream& operator<<(unsigned short n) {return operator<<((unsigned int)n);}

    ostream& operator<<(bool b) { return operator<<((int)b); }

    ostream& operator<<(double n);
    ostream& operator<<(float n) { return operator<<((double)n); }



    ostream& operator<<(long double n) { return operator<<((double)n); }

    ostream& operator<<(__omanip func) { return (*func)(*this); }
    ostream& operator<<(__manip func) {(*func)(*this); return *this;}
    ostream& operator<<(streambuf*);



};

class istream : virtual public ios
{
     
protected:
    _G_size_t  _gcount;

    int _skip_ws();
  public:
    istream(): _gcount (0) { }
    istream(streambuf* sb, ostream*tied= __null );
    istream& get(char* ptr, int len, char delim = '\n');
    istream& get(unsigned char* ptr, int len, char delim = '\n')
	{ return get((char*)ptr, len, delim); }
    istream& get(char& c);
    istream& get(unsigned char& c) { return get((char&)c); }
    istream& getline(char* ptr, int len, char delim = '\n');
    istream& getline(unsigned char* ptr, int len, char delim = '\n')
	{ return getline((char*)ptr, len, delim); }
    istream& get(signed char& c)  { return get((char&)c); }
    istream& get(signed char* ptr, int len, char delim = '\n')
	{ return get((char*)ptr, len, delim); }
    istream& getline(signed char* ptr, int len, char delim = '\n')
	{ return getline((char*)ptr, len, delim); }
    istream& read(char *ptr, streamsize n);
    istream& read(unsigned char *ptr, streamsize n)
      { return read((char*)ptr, n); }
    istream& read(signed char *ptr, streamsize n)
      { return read((char*)ptr, n); }
    istream& read(void *ptr, streamsize n)
      { return read((char*)ptr, n); }
    istream& get(streambuf& sb, char delim = '\n');
    istream& gets(char **s, char delim = '\n');
    int ipfx(int need = 0) {
	if (!good()) { set(ios::failbit); return 0; }
	else {
	   ;
	  if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush();
	  if (!need && (flags() & ios::skipws)) return _skip_ws();
	  else return 1;
	}
    }
    int ipfx0() {  
	if (!good()) { set(ios::failbit); return 0; }
	else {
	   ;
	  if (_tie) _tie->flush();
	  if (flags() & ios::skipws) return _skip_ws();
	  else return 1;
	}
    }
    int ipfx1() {  
	if (!good()) { set(ios::failbit); return 0; }
	else {
	   ;
	  if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
	  return 1;
	}
    }
    void isfx() {  ; }
    int get() { if (!ipfx1()) return (-1) ;
		else { int ch = _strbuf->sbumpc();
		       if (ch == (-1) ) set(ios::eofbit);
		       isfx();
		       return ch;
		     } }
    int peek();
    _G_size_t  gcount() { return _gcount; }
    istream& ignore(int n=1, int delim = (-1) );
    int sync ();
    istream& seekg(streampos);
    istream& seekg(streamoff, _seek_dir);
    streampos tellg();
    istream& putback(char ch) {
	if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit);
	return *this;}
    istream& unget() {
	if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit);
	return *this;}
    istream& scan(const char *format ...);
    istream& vscan(const char *format, _G_va_list  args);






    istream& operator>>(char*);
    istream& operator>>(unsigned char* p) { return operator>>((char*)p); }
    istream& operator>>(signed char*p) { return operator>>((char*)p); }
    istream& operator>>(char& c);
    istream& operator>>(unsigned char& c) {return operator>>((char&)c);}
    istream& operator>>(signed char& c) {return operator>>((char&)c);}
    istream& operator>>(int&);
    istream& operator>>(long&);

    __extension__ istream& operator>>(long long&);
    __extension__ istream& operator>>(unsigned long long&);

    istream& operator>>(short&);
    istream& operator>>(unsigned int&);
    istream& operator>>(unsigned long&);
    istream& operator>>(unsigned short&);

    istream& operator>>(bool&);

    istream& operator>>(float&);
    istream& operator>>(double&);
    istream& operator>>(long double&);
    istream& operator>>( __manip func) {(*func)(*this); return *this;}
    istream& operator>>(__imanip func) { return (*func)(*this); }
    istream& operator>>(streambuf*);
};

class iostream : public istream, public ostream
{
  public:
    iostream() { }
    iostream(streambuf* sb, ostream*tied= __null );
};

class _IO_istream_withassign : public istream {
public:
  _IO_istream_withassign& operator=(istream&);
  _IO_istream_withassign& operator=(_IO_istream_withassign& rhs)
    { return operator= (static_cast<istream&> (rhs)); }
};

class _IO_ostream_withassign : public ostream {
public:
  _IO_ostream_withassign& operator=(ostream&);
  _IO_ostream_withassign& operator=(_IO_ostream_withassign& rhs)
    { return operator= (static_cast<ostream&> (rhs)); }
};

extern _IO_istream_withassign cin;
 
extern _IO_ostream_withassign cout, cerr;

extern _IO_ostream_withassign clog



;

extern istream& lock(istream& ins);
extern istream& unlock(istream& ins);
extern ostream& lock(ostream& outs);
extern ostream& unlock(ostream& outs);

struct Iostream_init { } ;   

inline ios& dec(ios& i)
{ i.setf(ios::dec, ios::dec|ios::hex|ios::oct); return i; }
inline ios& hex(ios& i)
{ i.setf(ios::hex, ios::dec|ios::hex|ios::oct); return i; }
inline ios& oct(ios& i)
{ i.setf(ios::oct, ios::dec|ios::hex|ios::oct); return i; }
}  


# 6 "/usr/include/g++-3/iostream" 2 3


# 8 "main.cpp" 2

# 1 "/usr/include/math.h" 1 3
 



extern "C" {



# 1 "/usr/include/sys/reent.h" 1 3
 

 





extern "C" {



# 1 "/usr/include/_ansi.h" 1 3
 

 











# 1 "/usr/include/sys/config.h" 1 3



 
 
# 14 "/usr/include/sys/config.h" 3


# 25 "/usr/include/sys/config.h" 3


 








# 44 "/usr/include/sys/config.h" 3




















































 
















typedef int __int32_t;
typedef unsigned int __uint32_t;

































 







# 15 "/usr/include/_ansi.h" 2 3


 
 































# 67 "/usr/include/_ansi.h" 3


 








# 13 "/usr/include/sys/reent.h" 2 3

# 1 "/usr/include/sys/_types.h" 1 3
 

 








typedef long _off_t;
typedef long _ssize_t;


# 14 "/usr/include/sys/reent.h" 2 3














typedef __uint32_t __ULong;


struct _glue 
{
  struct _glue *_next;
  int _niobs;
  struct __sFILE *_iobs;
};

struct _Bigint 
{
  struct _Bigint *_next;
  int _k, _maxwds, _sign, _wds;
  __ULong _x[1];
};

 
struct __tm
{
  int   __tm_sec;
  int   __tm_min;
  int   __tm_hour;
  int   __tm_mday;
  int   __tm_mon;
  int   __tm_year;
  int   __tm_wday;
  int   __tm_yday;
  int   __tm_isdst;
};

 





struct _atexit {
	struct	_atexit *_next;			 
	int	_ind;				 
	void	(*_fns[32 ])(void);	 
};

 






struct __sbuf {
	unsigned char *_base;
	int	_size;
};

 




typedef long _fpos_t;		 
				 

 
























struct __sFILE {
  unsigned char *_p;	 
  int	_r;		 
  int	_w;		 
  short	_flags;		 
  short	_file;		 
  struct __sbuf _bf;	 
  int	_lbfsize;	 

   
  void * 	_cookie;	 

  _ssize_t  __attribute__((__cdecl__))   (*_read)   (void *  _cookie, char *_buf, int _n)  ;
  _ssize_t  __attribute__((__cdecl__))   (*_write)   (void *  _cookie, const char *_buf,
					    int _n)  ;
  _fpos_t __attribute__((__cdecl__))   (*_seek)   (void *  _cookie, _fpos_t _offset, int _whence)  ;
  int	__attribute__((__cdecl__))   (*_close)   (void *  _cookie)  ;

   
  struct __sbuf _ub;	 
  unsigned char *_up;	 
  int	_ur;		 

   
  unsigned char _ubuf[3];	 
  unsigned char _nbuf[1];	 

   
  struct __sbuf _lb;	 

   
  int	_blksize;	 
  int	_offset;	 

  struct _reent *_data;
};

 




















struct _rand48 {
  unsigned short _seed[3];
  unsigned short _mult[3];
  unsigned short _add;
};

 







struct _reent
{
   
  int _errno;

   


  struct __sFILE *_stdin, *_stdout, *_stderr;

  int  _inc;			 
  char _emergency[25];
 
  int _current_category;	 
  const  char *_current_locale;

  int __sdidinit;		 

  void __attribute__((__cdecl__))   (*__cleanup)   (struct _reent *)  ;

   
  struct _Bigint *_result;
  int _result_k;
  struct _Bigint *_p5s;
  struct _Bigint **_freelist;

   
  int _cvtlen;			 
  char *_cvtbuf;

  union
    {
      struct
        {
          unsigned int _unused_rand;
          char * _strtok_last;
          char _asctime_buf[26];
          struct __tm _localtime_buf;
          int _gamma_signgam;
          __extension__ unsigned long long _rand_next;
          struct _rand48 _r48;
        } _reent;
   

 
      struct
        {

          unsigned char * _nextf[30 ];
          unsigned int _nmalloc[30 ];
        } _unused;
    } _new;

   
  struct _atexit *_atexit;	 
  struct _atexit _atexit0;	 

   
  void (**(_sig_func))(int);

   


  struct _glue __sglue;			 
  struct __sFILE __sf[3];		 
};










 








extern struct _reent *_impure_ptr  ;

void _reclaim_reent   (struct _reent *)    ;

 






}


# 9 "/usr/include/math.h" 2 3

# 1 "/usr/include/machine/ieeefp.h" 1 3



 






















































# 68 "/usr/include/machine/ieeefp.h" 3

































 







































# 149 "/usr/include/machine/ieeefp.h" 3














































# 10 "/usr/include/math.h" 2 3





 


union __dmath
{
  __uint32_t i[2];
  double d;
};

 


extern __attribute__(( dllimport ))   const union __dmath __infinity[];





 


extern double atan   (double)    ;
extern double cos   (double)    ;
extern double sin   (double)    ;
extern double tan   (double)    ;
extern double tanh   (double)    ;
extern double frexp   (double, int *)    ;
extern double modf   (double, double *)    ;
extern double ceil   (double)    ;
extern double fabs   (double)    ;
extern double floor   (double)    ;


 



extern double acos   (double)    ;
extern double asin   (double)    ;
extern double atan2   (double, double)    ;
extern double cosh   (double)    ;
extern double sinh   (double)    ;
extern double exp   (double)    ;
extern double ldexp   (double, int)    ;
extern double log   (double)    ;
extern double log10   (double)    ;
extern double pow   (double, double)    ;
extern double sqrt   (double)    ;
extern double fmod   (double, double)    ;





 

extern double infinity   (void)    ;
extern double nan   (void)    ;
extern int isnan   (double)    ;
extern int isinf   (double)    ;
extern int finite   (double)    ;
extern double copysign   (double, double)    ;
extern int ilogb   (double)    ;

extern double asinh   (double)    ;
extern double cbrt   (double)    ;
extern double nextafter   (double, double)    ;
extern double rint   (double)    ;
extern double scalbn   (double, int)    ;


extern double log1p   (double)    ;
extern double expm1   (double)    ;



extern double acosh   (double)    ;
extern double atanh   (double)    ;
extern double remainder   (double, double)    ;
extern double gamma   (double)    ;
extern double gamma_r   (double, int *)    ;
extern double lgamma   (double)    ;
extern double lgamma_r   (double, int *)    ;
extern double erf   (double)    ;
extern double erfc   (double)    ;
extern double y0   (double)    ;
extern double y1   (double)    ;
extern double yn   (int, double)    ;
extern double j0   (double)    ;
extern double j1   (double)    ;
extern double jn   (int, double)    ;



extern double hypot   (double, double)    ;


extern double cabs();
extern double drem   (double, double)    ;



 

extern float atanf   (float)    ;
extern float cosf   (float)    ;
extern float sinf   (float)    ;
extern float tanf   (float)    ;
extern float tanhf   (float)    ;
extern float frexpf   (float, int *)    ;
extern float modff   (float, float *)    ;
extern float ceilf   (float)    ;
extern float fabsf   (float)    ;
extern float floorf   (float)    ;


extern float acosf   (float)    ;
extern float asinf   (float)    ;
extern float atan2f   (float, float)    ;
extern float coshf   (float)    ;
extern float sinhf   (float)    ;
extern float expf   (float)    ;
extern float ldexpf   (float, int)    ;
extern float logf   (float)    ;
extern float log10f   (float)    ;
extern float powf   (float, float)    ;
extern float sqrtf   (float)    ;
extern float fmodf   (float, float)    ;


 

extern float infinityf   (void)    ;
extern float nanf   (void)    ;
extern int isnanf   (float)    ;
extern int isinff   (float)    ;
extern int finitef   (float)    ;
extern float copysignf   (float, float)    ;
extern int ilogbf   (float)    ;

extern float asinhf   (float)    ;
extern float cbrtf   (float)    ;
extern float nextafterf   (float, float)    ;
extern float rintf   (float)    ;
extern float scalbnf   (float, int)    ;
extern float log1pf   (float)    ;
extern float expm1f   (float)    ;


extern float acoshf   (float)    ;
extern float atanhf   (float)    ;
extern float remainderf   (float, float)    ;
extern float gammaf   (float)    ;
extern float gammaf_r   (float, int *)    ;
extern float lgammaf   (float)    ;
extern float lgammaf_r   (float, int *)    ;
extern float erff   (float)    ;
extern float erfcf   (float)    ;
extern float y0f   (float)    ;
extern float y1f   (float)    ;
extern float ynf   (int, float)    ;
extern float j0f   (float)    ;
extern float j1f   (float)    ;
extern float jnf   (int, float)    ;

extern float hypotf   (float, float)    ;

extern float cabsf();
extern float dremf   (float, float)    ;



 


extern int *__signgam   (void)    ;




 


struct __exception 



{
  int type;
  char *name;
  double arg1;
  double arg2;
  double retval;
  int err;
};


extern int matherr   (struct __exception *e)    ;




 








 
























 

enum __fdlibm_version
{
  __fdlibm_ieee = -1,
  __fdlibm_svid,
  __fdlibm_xopen,
  __fdlibm_posix
};




extern __attribute__(( dllimport ))   const  enum __fdlibm_version  __fdlib_version ;













}


# 9 "main.cpp" 2

# 1 "angle.h" 1
 















namespace fishtank
{
using namespace std;

class Angle
{
protected:
	float v;	 
public:

	const Angle operator+(const Angle &rhs)const
	{
		Angle ret;
		ret.v=v+rhs.v;
		return ret;
	}

	const float deg(void)const
	{
		return v*360.0;
	}

	const float deg(float x)
	{
		v=x/360.0;
		return deg();
	}

	const float rad(void)const
	{
		return v* (3.141592) *2.0;
	}

	const float rad(float x)
	{
		v=x/((3.141592) *2.0);
		return rad();
	}

	const float rot(void)const
	{
		return v;
	}

	const float rot(float x)
	{
		v=x;
		return rot();
	}

	const float cos(void)const
	{
		return ::cos(rad());
	}

	const float sin(void)const
	{
		return ::sin(rad());
	}

	friend class radians;
	friend class degrees;
	friend class rotations;
};

class radians : public Angle
{
public:
	radians(float a)
	{
		rad(a);
	}
	radians(Angle a)
	{
		v=a.v;
	}

	operator float()const
	{
		return rad();
	}
};

class degrees : public Angle
{
public:
	degrees(float a)
	{
		deg(a);
	}
	degrees(Angle a)
	{
		v=a.v;
	}

	operator float()const
	{
		return deg();
	}
};

class rotations : public Angle
{
public:
	rotations(float a)
	{
		rot(a);
	}
	rotations(Angle a)
	{
		v=a.v;
	}

	operator float()const
	{
		return rot();
	}
};


};  


# 10 "main.cpp" 2

# 1 "vector.h" 1
 












namespace fishtank
{

template<class T>
class _vector
{
protected:
	T data[4];
public:
	_vector(T a, T b, T c, T d)
	{
		data[0]=a;
		data[1]=b;
		data[2]=c;
		data[3]=d;
	}

	typedef T unit;
	
	T & operator[](int i)
	{
		return data[i];
	}
	const T & operator[](int i)const
	{
		return data[i];
	}
	const _vector<T> operator+(const _vector<T> &rhs) const
	{
		return _vector<T>(data[0]+rhs[0],data[1]+rhs[1],data[2]+rhs[2],data[3]+rhs[3]);
	}

	const _vector<T> operator-(const _vector<T> &rhs) const
	{
		return _vector<T>(data[0]-rhs[0],data[1]-rhs[1],data[2]-rhs[2],data[3]-rhs[3]);
	}

	const _vector<T> operator*(const T &rhs) const
	{
		return _vector<T>(data[0]*rhs,data[1]*rhs,data[2]*rhs,data[3]*rhs);
	}

	void operator+=(const _vector<T> &rhs)
	{
		data[0]+=rhs[0];
		data[1]+=rhs[1];
		data[2]+=rhs[2];
		data[3]+=rhs[3];
	}

	void operator-=(const _vector<T> &rhs)
	{
		data[0]-=rhs[0];
		data[1]-=rhs[1];
		data[2]-=rhs[2];
		data[3]-=rhs[3];
	}

	void operator*=(const T &rhs)
	{
		data[0]*=rhs;
		data[1]*=rhs;
		data[2]*=rhs;
		data[3]*=rhs;
	}

	bool operator==(const _vector<T> &rhs)const
	{
		return ((data[0]==rhs[0]) && (data[1]==rhs[1])) && ((data[2]==rhs[2]) && (data[3]==rhs[3]));
	}

	bool operator!=(const _vector<T> &rhs)const
	{
		return ((data[0]!=rhs[0]) || (data[1]!=rhs[1])) || ((data[2]!=rhs[2]) || (data[3]!=rhs[3]));
	}
};

class Vector : public _vector<float>
{
public:
	Vector(unit a=0, unit b=0, unit c=0, unit d=0):_vector<unit>(a,b,c,d) { }
	Vector(_vector<unit> x):_vector<unit>(x) { }

	const unit operator*(const Vector &rhs) const
	{
		return unit(data[0]*rhs[0]+data[1]*rhs[1]+data[2]*rhs[2]+data[3]*rhs[3]);
	}
	
	static const Vector axis(int i)
	{
		Vector ret;
		ret[i]=1;
		return ret;
	}
};

class Point : public _vector<float>
{
public:
	Point(unit a=0, unit b=0, unit c=0, unit d=1):_vector<unit>(a,b,c,d) { }
	Point(_vector<unit> x):_vector<unit>(x) { }

	static const Point origin(void)
	{
		return Point(0,0,0);
	}
};

inline const Point operator+(const Vector &lhs,const Point &rhs)
{
	return (Point)((_vector<Vector::unit>)lhs+(_vector<Vector::unit>)rhs);
}

inline const Point operator+(const Point &lhs,const Vector &rhs)
{
	return (Point)((_vector<Point::unit>)lhs+(_vector<Point::unit>)rhs);
}

inline const Vector operator-(const Point &lhs,const Point &rhs)
{
	return (Vector)((_vector<Point::unit>)lhs-(_vector<Point::unit>)rhs);
}

class Matrix : public _vector<Vector>
{
public:	
	class ident;

	Matrix(Vector a=0, Vector b=0, Vector c=0, Vector d=0):_vector<Vector>(a,b,c,d) { }
	Matrix(Vector::unit x):_vector<Vector>(ident())
	{
		(*this)*=x;
	}

	const Vector operator()(int i)const
	{
		return Vector(data[0][i],data[1][i],data[2][i],data[3][i]);
	}

	const Matrix operator*(const Matrix &rhs)const
	{
		Matrix ret;
		for(int j=0;j<4;j++)
			for(int i=0;i<4;i++)
				ret[j][i]=data[j]*rhs(i);
		return ret;
	}

	const Vector operator*(const Vector &rhs)const
	{
		return Vector(data[0]*rhs,data[1]*rhs,data[2]*rhs,data[3]*rhs);
	}

	const Matrix operator*=(const Matrix &rhs)
	{
		 
		return (*this=rhs*(*this));
	}

	const Vector operator*(const Vector::unit &rhs)const
	{
		return *this*rhs;
	}

	class ident
	{
	public:
		operator Matrix(void)const
		{
			return Matrix(Vector(1,0,0,0),Vector(0,1,0,0),Vector(0,0,1,0),Vector(0,0,0,1));
		}
	};

	struct rotateX
	{
		Angle theta;
	public:
		rotateX(Angle x):theta(x) { };

		const rotateX operator*(const rotateX &rhs)const
		{
			return rotateX(theta+rhs.theta);
		}

		template <class T>
		const Matrix operator*(const T &rhs)const
		{
			return Matrix(*this)*rhs;
		}

		operator Matrix(void)const
		{
			Matrix ret=ident();
			ret[1][1]= ret[2][2]=theta.cos();
			ret[1][2]= -(ret[2][1]=theta.sin());
			return ret;
		}
	};
	struct rotateY
	{
		Angle theta;
	public:
		rotateY(Angle x):theta(x) { };

		const rotateY operator*(const rotateY &rhs)const
		{
			return rotateY(theta+rhs.theta);
		}

		template <class T>
		const Matrix operator*(const T &rhs)const
		{
			return Matrix(*this)*rhs;
		}

		operator Matrix(void)const
		{
			Matrix ret=ident();
			ret[0][0]= ret[2][2]=theta.cos();
			ret[2][0]= -(ret[0][2]=theta.sin());
			return ret;
		}
	};
	struct rotateZ
	{
		Angle theta;
	public:
		rotateZ(Angle x):theta(x) { };

		const rotateZ operator*(const rotateZ &rhs)const
		{
			return rotateZ(theta+rhs.theta);
		}

		template <class T>
		const Matrix operator*(const T &rhs)const
		{
			return Matrix(*this)*rhs;
		}

		operator Matrix(void)const
		{
			Matrix ret=ident();
			ret[0][0]= ret[1][1]=theta.cos();
			ret[0][1]= -(ret[1][0]=theta.sin());
			return ret;
		}
	};
	class translate
	{
		Point pos;
	public:
		translate(Point x):pos(x) { };

		template <class T>
		const Matrix operator*(const T &rhs)const
		{
			return Matrix(*this)*rhs;
		}

		operator Matrix(void)const
		{
			Matrix ret=ident();
			ret[0][3]=pos[0];
			ret[1][3]=pos[1];
			ret[2][3]=pos[2];
			return ret;
		}
	};
};

template<class T>
ostream &operator<<(ostream &s,const _vector<T> &rhs)
{
	return s<<'['<<rhs[0]<<", "<<rhs[1]<<", "<<rhs[2]<<", "<<rhs[3]<<']';
}

};  



# 11 "main.cpp" 2

# 1 "spoint.h" 1
 












namespace fishtank
{

struct SPoint
{
	int x,y;

	SPoint() { }
	SPoint(int X, int Y):x(X),y(Y) { }
	SPoint(Point pos)
	{
		cout<<pos[0]<<"/"<<pos[3]<<endl;
		cout<<pos[1]<<"/"<<pos[3]<<endl;
		x=(int)(pos[0]/pos[3]);
		y=(int)(pos[1]/pos[3]);
	}
};

inline ostream &operator<<(ostream &s,const SPoint &rhs)
{
	return s<<'('<<rhs.x<<","<<rhs.y<<')';
}

};  



# 12 "main.cpp" 2

# 1 "coordsys.h" 1
 













namespace fishtank
{

struct CoordSys : public Matrix
{
	CoordSys *parent;
	
	CoordSys():parent(__null ) { }
	CoordSys(Matrix M):Matrix(M),parent(__null ) { }
	CoordSys(CoordSys *prnt):parent(prnt) { }

	const Matrix collapse(CoordSys *target= __null )const
	{
		Matrix ret=*this;
		for(CoordSys *pos;pos!=target;pos=pos->parent)
			ret*= *pos;
		return ret;
	}

	const CoordSys &operator=(const Matrix &x)
	{
		(Matrix)(*this)=x;
		return *this;
	}
};

};  



# 13 "main.cpp" 2

# 1 "object.h" 1
 









# 1 "/usr/include/g++-3/list" 1 3
 




























# 1 "/usr/include/g++-3/stl_algobase.h" 1 3
 

























 








# 1 "/usr/include/g++-3/stl_config.h" 1 3
 




























 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 
 
 
 
 


 

 
 
 
 
 
 
 








# 148 "/usr/include/g++-3/stl_config.h" 3




















# 178 "/usr/include/g++-3/stl_config.h" 3



































# 237 "/usr/include/g++-3/stl_config.h" 3


# 251 "/usr/include/g++-3/stl_config.h" 3



































 
 
 
 


















 
 
# 319 "/usr/include/g++-3/stl_config.h" 3






































 
 
 
# 36 "/usr/include/g++-3/stl_algobase.h" 2 3



# 1 "/usr/include/g++-3/stl_relops.h" 1 3
 

























 






 

template <class _Tp>
inline bool operator!=(const _Tp& __x, const _Tp& __y) {
  return !(__x == __y);
}

template <class _Tp>
inline bool operator>(const _Tp& __x, const _Tp& __y) {
  return __y < __x;
}

template <class _Tp>
inline bool operator<=(const _Tp& __x, const _Tp& __y) {
  return !(__y < __x);
}

template <class _Tp>
inline bool operator>=(const _Tp& __x, const _Tp& __y) {
  return !(__x < __y);
}

 



 
 
 
# 39 "/usr/include/g++-3/stl_algobase.h" 2 3



# 1 "/usr/include/g++-3/stl_pair.h" 1 3
 

























 






 

template <class _T1, class _T2>
struct pair {
  typedef _T1 first_type;
  typedef _T2 second_type;

  _T1 first;
  _T2 second;
  pair() : first(_T1()), second(_T2()) {}
  pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}


  template <class _U1, class _U2>
  pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}

};

template <class _T1, class _T2>
inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
{ 
  return __x.first == __y.first && __x.second == __y.second; 
}

template <class _T1, class _T2>
inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
{ 
  return __x.first < __y.first || 
         (!(__y.first < __x.first) && __x.second < __y.second); 
}

template <class _T1, class _T2>
inline pair<_T1, _T2> make_pair(const _T1& __x, const _T2& __y)
{
  return pair<_T1, _T2>(__x, __y);
}

 



 
 
 
# 42 "/usr/include/g++-3/stl_algobase.h" 2 3



# 1 "/usr/include/g++-3/type_traits.h" 1 3
 




















 
































struct __true_type {
};

struct __false_type {
};

template <class _Tp>
struct __type_traits { 
   typedef __true_type     this_dummy_member_must_be_first;
                    





    








 

   typedef __false_type    has_trivial_default_constructor;
   typedef __false_type    has_trivial_copy_constructor;
   typedef __false_type    has_trivial_assignment_operator;
   typedef __false_type    has_trivial_destructor;
   typedef __false_type    is_POD_type;
};



 
 
 



template<>  struct __type_traits<bool> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};



template<>  struct __type_traits<char> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};

template<>  struct __type_traits<signed char> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};

template<>  struct __type_traits<unsigned char> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};



template<>  struct __type_traits<wchar_t> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};



template<>  struct __type_traits<short> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};

template<>  struct __type_traits<unsigned short> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};

template<>  struct __type_traits<int> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};

template<>  struct __type_traits<unsigned int> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};

template<>  struct __type_traits<long> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};

template<>  struct __type_traits<unsigned long> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};



template<>  struct __type_traits<long long> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};

template<>  struct __type_traits<unsigned long long> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};



template<>  struct __type_traits<float> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};

template<>  struct __type_traits<double> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};

template<>  struct __type_traits<long double> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};



template <class _Tp>
struct __type_traits<_Tp*> {
   typedef __true_type    has_trivial_default_constructor;
   typedef __true_type    has_trivial_copy_constructor;
   typedef __true_type    has_trivial_assignment_operator;
   typedef __true_type    has_trivial_destructor;
   typedef __true_type    is_POD_type;
};

# 295 "/usr/include/g++-3/type_traits.h" 3



 
 

template <class _Tp> struct _Is_integer {
  typedef __false_type _Integral;
};



template<>  struct _Is_integer<bool> {
  typedef __true_type _Integral;
};



template<>  struct _Is_integer<char> {
  typedef __true_type _Integral;
};

template<>  struct _Is_integer<signed char> {
  typedef __true_type _Integral;
};

template<>  struct _Is_integer<unsigned char> {
  typedef __true_type _Integral;
};



template<>  struct _Is_integer<wchar_t> {
  typedef __true_type _Integral;
};



template<>  struct _Is_integer<short> {
  typedef __true_type _Integral;
};

template<>  struct _Is_integer<unsigned short> {
  typedef __true_type _Integral;
};

template<>  struct _Is_integer<int> {
  typedef __true_type _Integral;
};

template<>  struct _Is_integer<unsigned int> {
  typedef __true_type _Integral;
};

template<>  struct _Is_integer<long> {
  typedef __true_type _Integral;
};

template<>  struct _Is_integer<unsigned long> {
  typedef __true_type _Integral;
};



template<>  struct _Is_integer<long long> {
  typedef __true_type _Integral;
};

template<>  struct _Is_integer<unsigned long long> {
  typedef __true_type _Integral;
};





 
 
 
# 45 "/usr/include/g++-3/stl_algobase.h" 2 3



# 1 "/usr/include/string.h" 1 3
 









extern "C" {






# 1 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 1 3








 


# 21 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3



 


 





 


# 63 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3


 





 


















 





 

 

# 133 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3


 

 


































typedef unsigned int size_t;






















 




 

# 273 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3


# 285 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3


 

 

# 319 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3




 






















# 18 "/usr/include/string.h" 2 3






void *  	 __attribute__((__cdecl__))   memchr   (const void * , int, size_t)  ;
int 	 __attribute__((__cdecl__))   memcmp   (const void * , const void * , size_t)  ;
void *  	 __attribute__((__cdecl__))   memcpy   (void * , const void * , size_t)  ;
void * 	 __attribute__((__cdecl__))   memmove   (void * , const void * , size_t)  ;
void * 	 __attribute__((__cdecl__))   memset   (void * , int, size_t)  ;
char 	* __attribute__((__cdecl__))   strcat   (char *, const char *)  ;
char 	* __attribute__((__cdecl__))   strchr   (const char *, int)  ;
int	 __attribute__((__cdecl__))   strcmp   (const char *, const char *)  ;
int	 __attribute__((__cdecl__))   strcoll   (const char *, const char *)  ;
char 	* __attribute__((__cdecl__))   strcpy   (char *, const char *)  ;
size_t	 __attribute__((__cdecl__))   strcspn   (const char *, const char *)  ;
char 	* __attribute__((__cdecl__))   strerror   (int)  ;
size_t	 __attribute__((__cdecl__))   strlen   (const char *)  ;
char 	* __attribute__((__cdecl__))   strncat   (char *, const char *, size_t)  ;
int	 __attribute__((__cdecl__))   strncmp   (const char *, const char *, size_t)  ;
char 	* __attribute__((__cdecl__))   strncpy   (char *, const char *, size_t)  ;
char 	* __attribute__((__cdecl__))   strpbrk   (const char *, const char *)  ;
char 	* __attribute__((__cdecl__))   strrchr   (const char *, int)  ;
size_t	 __attribute__((__cdecl__))   strspn   (const char *, const char *)  ;
char 	* __attribute__((__cdecl__))   strstr   (const char *, const char *)  ;


char 	* __attribute__((__cdecl__))   strtok   (char *, const char *)  ;


size_t	 __attribute__((__cdecl__))   strxfrm   (char *, const char *, size_t)  ;


char 	* __attribute__((__cdecl__))   strtok_r   (char *, const char *, char **)  ;

int	 __attribute__((__cdecl__))   bcmp   (const char *, const char *, size_t)  ;
void	 __attribute__((__cdecl__))   bcopy   (const char *, char *, size_t)  ;
void	 __attribute__((__cdecl__))   bzero   (char *, size_t)  ;
int	 __attribute__((__cdecl__))   ffs   (int)  ;
char 	* __attribute__((__cdecl__))   index   (const char *, int)  ;
void * 	 __attribute__((__cdecl__))   memccpy   (void * , const void * , int, size_t)  ;
char 	* __attribute__((__cdecl__))   rindex   (const char *, int)  ;
int	 __attribute__((__cdecl__))   strcasecmp   (const char *, const char *)  ;
char 	* __attribute__((__cdecl__))   strdup   (const char *)  ;
char 	* __attribute__((__cdecl__))   _strdup_r   (struct _reent *, const char *)  ;
int	 __attribute__((__cdecl__))   strncasecmp   (const char *, const char *, size_t)  ;
char 	* __attribute__((__cdecl__))   strsep   (char **, const char *)  ;
char	* __attribute__((__cdecl__))   strlwr   (char *)  ;
char	* __attribute__((__cdecl__))   strupr   (char *)  ;


const char  * __attribute__((__cdecl__))   strsignal    (int __signo)  ;

int     __attribute__((__cdecl__))   strtosigno    (const char *__name)  ;


 
















}


# 48 "/usr/include/g++-3/stl_algobase.h" 2 3

# 1 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/limits.h" 1 3
 


 





 
# 1 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/syslimits.h" 1 3
 





# 1 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/limits.h" 1 3
 


 

# 114 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/limits.h" 3



# 1 "/usr/include/limits.h" 1 3
 












 



 



 




 





 



 












 





 



 








 



 













 




 








 




 



 



 


 
 


 



 






 




 
 
 

















# 117 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/limits.h" 2 3




# 7 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/syslimits.h" 2 3


# 11 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/limits.h" 2 3


# 110 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/limits.h" 3

 









# 49 "/usr/include/g++-3/stl_algobase.h" 2 3

# 1 "/usr/include/stdlib.h" 1 3
 







extern "C" {







# 1 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 1 3








 


# 21 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3



 


 





 


# 63 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3


 





 


















 





 

 

# 133 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3


 

 


# 190 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3





 




 





























 












































# 285 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3


 

 

# 319 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3




 






















# 17 "/usr/include/stdlib.h" 2 3




typedef struct 
{
  int quot;  
  int rem;  
} div_t;

typedef struct 
{
  long quot;  
  long rem;  
} ldiv_t;










extern __attribute__(( dllimport ))   int __mb_cur_max;



void 	__attribute__((__cdecl__))   abort   (void ) __attribute__ ( (noreturn) )   ;
int	__attribute__((__cdecl__))   abs   (int)  ;
int	__attribute__((__cdecl__))   atexit   (void  (*__func)(void ))  ;
double	__attribute__((__cdecl__))   atof   (const char *__nptr)  ;

float	__attribute__((__cdecl__))   atoff   (const char *__nptr)  ;

int	__attribute__((__cdecl__))   atoi   (const char *__nptr)  ;
long	__attribute__((__cdecl__))   atol   (const char *__nptr)  ;
void * 	__attribute__((__cdecl__))   bsearch   (const void *  __key,
		       const void *  __base,
		       size_t __nmemb,
		       size_t __size,
		       int (* __attribute__((__cdecl__))   _compar )  (const void * , const void * )  )  ;
void * 	__attribute__((__cdecl__))   calloc   (size_t __nmemb, size_t __size)  ;
div_t	__attribute__((__cdecl__))   div   (int __numer, int __denom)  ;
void 	__attribute__((__cdecl__))   exit   (int __status) __attribute__ ( (noreturn) )   ;
void 	__attribute__((__cdecl__))   free   (void * )  ;
char *  __attribute__((__cdecl__))   getenv   (const char *__string)  ;
char *	__attribute__((__cdecl__))   _getenv_r   (struct _reent *, const char *__string)  ;
char *	__attribute__((__cdecl__))   _findenv   (const  char *, int *)  ;
char *	__attribute__((__cdecl__))   _findenv_r   (struct _reent *, const  char *, int *)  ;
long	__attribute__((__cdecl__))   labs   (long)  ;
ldiv_t	__attribute__((__cdecl__))   ldiv   (long __numer, long __denom)  ;
void * 	__attribute__((__cdecl__))   malloc   (size_t __size)  ;
int	__attribute__((__cdecl__))   mblen   (const char *, size_t)  ;
int	__attribute__((__cdecl__))   _mblen_r   (struct _reent *, const char *, size_t, int *)  ;
int	__attribute__((__cdecl__))   mbtowc   (wchar_t *, const char *, size_t)  ;
int	__attribute__((__cdecl__))   _mbtowc_r   (struct _reent *, wchar_t *, const char *, size_t, int *)  ;
int	__attribute__((__cdecl__))   wctomb   (char *, wchar_t)  ;
int	__attribute__((__cdecl__))   _wctomb_r   (struct _reent *, char *, wchar_t, int *)  ;
size_t	__attribute__((__cdecl__))   mbstowcs   (wchar_t *, const char *, size_t)  ;
size_t	__attribute__((__cdecl__))   _mbstowcs_r   (struct _reent *, wchar_t *, const char *, size_t, int *)  ;
size_t	__attribute__((__cdecl__))   wcstombs   (char *, const wchar_t *, size_t)  ;
size_t	__attribute__((__cdecl__))   _wcstombs_r   (struct _reent *, char *, const wchar_t *, size_t, int *)  ;


int     __attribute__((__cdecl__))   mkstemp   (char *)  ;
char *  __attribute__((__cdecl__))   mktemp   (char *)  ;


void 	__attribute__((__cdecl__))   qsort   (void *  __base, size_t __nmemb, size_t __size, int(*_compar)(const void * , const void * ))  ;
int	__attribute__((__cdecl__))   rand   (void )  ;
void * 	__attribute__((__cdecl__))   realloc   (void *  __r, size_t __size)  ;
void 	__attribute__((__cdecl__))   srand   (unsigned __seed)  ;
double	__attribute__((__cdecl__))   strtod   (const char *__n, char **_end_PTR)  ;
double	__attribute__((__cdecl__))   _strtod_r   (struct _reent *,const char *__n, char **_end_PTR)  ;

float	__attribute__((__cdecl__))   strtodf   (const char *__n, char **_end_PTR)  ;

long	__attribute__((__cdecl__))   strtol   (const char *__n, char **_end_PTR, int __base)  ;
long	__attribute__((__cdecl__))   _strtol_r   (struct _reent *,const char *__n, char **_end_PTR, int __base)  ;
unsigned long __attribute__((__cdecl__))   strtoul   (const char *_n_PTR, char **_end_PTR, int __base)  ;
unsigned long __attribute__((__cdecl__))   _strtoul_r   (struct _reent *,const char *_n_PTR, char **_end_PTR, int __base)  ;
int	__attribute__((__cdecl__))   system   (const char *__string)  ;


int	__attribute__((__cdecl__))   putenv   (const char *__string)  ;
int	__attribute__((__cdecl__))   _putenv_r   (struct _reent *, const char *__string)  ;
int	__attribute__((__cdecl__))   setenv   (const char *__string, const char *__value, int __overwrite)  ;
int	__attribute__((__cdecl__))   _setenv_r   (struct _reent *, const char *__string, const char *__value, int __overwrite)  ;

char *	__attribute__((__cdecl__))   gcvt   (double,int,char *)  ;
char *	__attribute__((__cdecl__))   gcvtf   (float,int,char *)  ;
char *	__attribute__((__cdecl__))   fcvt   (double,int,int *,int *)  ;
char *	__attribute__((__cdecl__))   fcvtf   (float,int,int *,int *)  ;
char *	__attribute__((__cdecl__))   ecvt   (double,int,int *,int *)  ;
char *	__attribute__((__cdecl__))   ecvtbuf   (double, int, int*, int*, char *)  ;
char *	__attribute__((__cdecl__))   fcvtbuf   (double, int, int*, int*, char *)  ;
char *	__attribute__((__cdecl__))   ecvtf   (float,int,int *,int *)  ;
char *	__attribute__((__cdecl__))   dtoa   (double, int, int, int *, int*, char**)  ;
int	__attribute__((__cdecl__))   rand_r   (unsigned *__seed)  ;

double __attribute__((__cdecl__))   drand48   (void )  ;
double __attribute__((__cdecl__))   _drand48_r   (struct _reent *)  ;
double __attribute__((__cdecl__))   erand48   (unsigned short [3])  ;
double __attribute__((__cdecl__))   _erand48_r   (struct _reent *, unsigned short [3])  ;
long   __attribute__((__cdecl__))   jrand48   (unsigned short [3])  ;
long   __attribute__((__cdecl__))   _jrand48_r   (struct _reent *, unsigned short [3])  ;
void   __attribute__((__cdecl__))   lcong48   (unsigned short [7])  ;
void   __attribute__((__cdecl__))   _lcong48_r   (struct _reent *, unsigned short [7])  ;
long   __attribute__((__cdecl__))   lrand48   (void )  ;
long   __attribute__((__cdecl__))   _lrand48_r   (struct _reent *)  ;
long   __attribute__((__cdecl__))   mrand48   (void )  ;
long   __attribute__((__cdecl__))   _mrand48_r   (struct _reent *)  ;
long   __attribute__((__cdecl__))   nrand48   (unsigned short [3])  ;
long   __attribute__((__cdecl__))   _nrand48_r   (struct _reent *, unsigned short [3])  ;
unsigned short *
       __attribute__((__cdecl__))   seed48   (unsigned short [3])  ;
unsigned short *
       __attribute__((__cdecl__))   _seed48_r   (struct _reent *, unsigned short [3])  ;
void   __attribute__((__cdecl__))   srand48   (long)  ;
void   __attribute__((__cdecl__))   _srand48_r   (struct _reent *, long)  ;




char *	__attribute__((__cdecl__))   realpath   (const char *, char *)  ;
void	__attribute__((__cdecl__))   unsetenv   (const char *__string)  ;
void	__attribute__((__cdecl__))   _unsetenv_r   (struct _reent *, const char *__string)  ;
int	__attribute__((__cdecl__))   random   (void )  ;
long	__attribute__((__cdecl__))   srandom   (unsigned __seed)  ;
char *  __attribute__((__cdecl__))   ptsname    (int)  ;
int     __attribute__((__cdecl__))   grantpt    (int)  ;
int     __attribute__((__cdecl__))   unlockpt   (int)  ;




char *	__attribute__((__cdecl__))   _dtoa_r   (struct _reent *, double, int, int, int *, int*, char**)  ;
void * 	__attribute__((__cdecl__))   _malloc_r   (struct _reent *, size_t)  ;
void * 	__attribute__((__cdecl__))   _calloc_r   (struct _reent *, size_t, size_t)  ;
void 	__attribute__((__cdecl__))   _free_r   (struct _reent *, void * )  ;
void * 	__attribute__((__cdecl__))   _realloc_r   (struct _reent *, void * , size_t)  ;
void 	__attribute__((__cdecl__))   _mstats_r   (struct _reent *, char *)  ;
int	__attribute__((__cdecl__))   _system_r   (struct _reent *, const char *)  ;

void 	__attribute__((__cdecl__))   __eprintf   (const char *, const char *, unsigned int, const char *)  ;


}


# 50 "/usr/include/g++-3/stl_algobase.h" 2 3

# 1 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 1 3








 







 

 




 


 





 


# 63 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3


 





 


















 





 

 





















typedef int ptrdiff_t;









 




 

 


# 190 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3





 




 


# 271 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3











typedef unsigned int  wint_t;




 

 

# 319 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3




 













 








# 51 "/usr/include/g++-3/stl_algobase.h" 2 3

# 1 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/new.h" 1 3
 




# 1 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/new" 1 3
 
 




#pragma interface "new"
# 1 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 1 3
# 345 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3

# 8 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/new" 2 3

# 1 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/exception" 1 3
 
 




#pragma interface "exception"

extern "C++" {

namespace std {

class exception {
public:
  exception () { }
  virtual ~exception () { }
  virtual const char* what () const;
};

class bad_exception : public exception {
public:
  bad_exception () { }
  virtual ~bad_exception () { }
};

typedef void (*terminate_handler) ();
typedef void (*unexpected_handler) ();

terminate_handler set_terminate (terminate_handler);
void terminate () __attribute__ ((__noreturn__));
unexpected_handler set_unexpected (unexpected_handler);
void unexpected () __attribute__ ((__noreturn__));
bool uncaught_exception ();

}  

}  


# 9 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/new" 2 3


extern "C++" {

namespace std {

  class bad_alloc : public exception {
  public:
    virtual const char* what() const throw() { return "bad_alloc"; }
  };

  struct nothrow_t {};
  extern const nothrow_t nothrow;
  typedef void (*new_handler)();
  new_handler set_new_handler (new_handler);

}  

 
void *operator new (size_t) throw (std::bad_alloc);
void *operator new[] (size_t) throw (std::bad_alloc);
void operator delete (void *) throw();
void operator delete[] (void *) throw();
void *operator new (size_t, const std::nothrow_t&) throw();
void *operator new[] (size_t, const std::nothrow_t&) throw();
void operator delete (void *, const std::nothrow_t&) throw();
void operator delete[] (void *, const std::nothrow_t&) throw();

 
inline void *operator new(size_t, void *place) throw() { return place; }
inline void *operator new[](size_t, void *place) throw() { return place; }
}  


# 6 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/new.h" 2 3


using std::new_handler;
using std::set_new_handler;


# 52 "/usr/include/g++-3/stl_algobase.h" 2 3




# 1 "/usr/include/g++-3/stl_iterator.h" 1 3
 

























 






 

struct input_iterator_tag {};
struct output_iterator_tag {};
struct forward_iterator_tag : public input_iterator_tag {};
struct bidirectional_iterator_tag : public forward_iterator_tag {};
struct random_access_iterator_tag : public bidirectional_iterator_tag {};

 
 
 
 

template <class _Tp, class _Distance> struct input_iterator {
  typedef input_iterator_tag iterator_category;
  typedef _Tp                value_type;
  typedef _Distance          difference_type;
  typedef _Tp*               pointer;
  typedef _Tp&               reference;
};

struct output_iterator {
  typedef output_iterator_tag iterator_category;
  typedef void                value_type;
  typedef void                difference_type;
  typedef void                pointer;
  typedef void                reference;
};

template <class _Tp, class _Distance> struct forward_iterator {
  typedef forward_iterator_tag iterator_category;
  typedef _Tp                  value_type;
  typedef _Distance            difference_type;
  typedef _Tp*                 pointer;
  typedef _Tp&                 reference;
};


template <class _Tp, class _Distance> struct bidirectional_iterator {
  typedef bidirectional_iterator_tag iterator_category;
  typedef _Tp                        value_type;
  typedef _Distance                  difference_type;
  typedef _Tp*                       pointer;
  typedef _Tp&                       reference;
};

template <class _Tp, class _Distance> struct random_access_iterator {
  typedef random_access_iterator_tag iterator_category;
  typedef _Tp                        value_type;
  typedef _Distance                  difference_type;
  typedef _Tp*                       pointer;
  typedef _Tp&                       reference;
};

# 98 "/usr/include/g++-3/stl_iterator.h" 3




template <class _Iterator>
struct iterator_traits {
  typedef typename _Iterator::iterator_category iterator_category;
  typedef typename _Iterator::value_type        value_type;
  typedef typename _Iterator::difference_type   difference_type;
  typedef typename _Iterator::pointer           pointer;
  typedef typename _Iterator::reference         reference;
};

template <class _Tp>
struct iterator_traits<_Tp*> {
  typedef random_access_iterator_tag iterator_category;
  typedef _Tp                         value_type;
  typedef ptrdiff_t                   difference_type;
  typedef _Tp*                        pointer;
  typedef _Tp&                        reference;
};

template <class _Tp>
struct iterator_traits<const _Tp*> {
  typedef random_access_iterator_tag iterator_category;
  typedef _Tp                         value_type;
  typedef ptrdiff_t                   difference_type;
  typedef const _Tp*                  pointer;
  typedef const _Tp&                  reference;
};

 
 
 
 

 

template <class _Iter>
inline typename iterator_traits<_Iter>::iterator_category
__iterator_category(const _Iter&)
{
  typedef typename iterator_traits<_Iter>::iterator_category _Category;
  return _Category();
}

template <class _Iter>
inline typename iterator_traits<_Iter>::difference_type*
__distance_type(const _Iter&)
{
  return static_cast<typename iterator_traits<_Iter>::difference_type*>(0);
}

template <class _Iter>
inline typename iterator_traits<_Iter>::value_type*
__value_type(const _Iter&)
{
  return static_cast<typename iterator_traits<_Iter>::value_type*>(0);
}

template <class _Iter>
inline typename iterator_traits<_Iter>::iterator_category
iterator_category(const _Iter& __i) { return __iterator_category(__i); }


template <class _Iter>
inline typename iterator_traits<_Iter>::difference_type*
distance_type(const _Iter& __i) { return __distance_type(__i); }

template <class _Iter>
inline typename iterator_traits<_Iter>::value_type*
value_type(const _Iter& __i) { return __value_type(__i); }





# 259 "/usr/include/g++-3/stl_iterator.h" 3


template <class _InputIterator, class _Distance>
inline void __distance(_InputIterator __first, _InputIterator __last,
                       _Distance& __n, input_iterator_tag)
{
  while (__first != __last) { ++__first; ++__n; }
}

template <class _RandomAccessIterator, class _Distance>
inline void __distance(_RandomAccessIterator __first, 
                       _RandomAccessIterator __last, 
                       _Distance& __n, random_access_iterator_tag)
{
  __n += __last - __first;
}

template <class _InputIterator, class _Distance>
inline void distance(_InputIterator __first, 
                     _InputIterator __last, _Distance& __n)
{
  __distance(__first, __last, __n, iterator_category(__first));
}



template <class _InputIterator>
inline typename iterator_traits<_InputIterator>::difference_type
__distance(_InputIterator __first, _InputIterator __last, input_iterator_tag)
{
  typename iterator_traits<_InputIterator>::difference_type __n = 0;
  while (__first != __last) {
    ++__first; ++__n;
  }
  return __n;
}

template <class _RandomAccessIterator>
inline typename iterator_traits<_RandomAccessIterator>::difference_type
__distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
           random_access_iterator_tag) {
  return __last - __first;
}

template <class _InputIterator>
inline typename iterator_traits<_InputIterator>::difference_type
distance(_InputIterator __first, _InputIterator __last) {
  typedef typename iterator_traits<_InputIterator>::iterator_category 
    _Category;
  return __distance(__first, __last, _Category());
}



template <class _InputIter, class _Distance>
inline void __advance(_InputIter& __i, _Distance __n, input_iterator_tag) {
  while (__n--) ++__i;
}





template <class _BidirectionalIterator, class _Distance>
inline void __advance(_BidirectionalIterator& __i, _Distance __n, 
                      bidirectional_iterator_tag) {
  if (__n >= 0)
    while (__n--) ++__i;
  else
    while (__n++) --__i;
}





template <class _RandomAccessIterator, class _Distance>
inline void __advance(_RandomAccessIterator& __i, _Distance __n, 
                      random_access_iterator_tag) {
  __i += __n;
}

template <class _InputIterator, class _Distance>
inline void advance(_InputIterator& __i, _Distance __n) {
  __advance(__i, __n, iterator_category(__i));
}

template <class _Container>
class back_insert_iterator {
protected:
  _Container* container;
public:
  typedef _Container          container_type;
  typedef output_iterator_tag iterator_category;
  typedef void                value_type;
  typedef void                difference_type;
  typedef void                pointer;
  typedef void                reference;

  explicit back_insert_iterator(_Container& __x) : container(&__x) {}
  back_insert_iterator<_Container>&
  operator=(const typename _Container::value_type& __value) { 
    container->push_back(__value);
    return *this;
  }
  back_insert_iterator<_Container>& operator*() { return *this; }
  back_insert_iterator<_Container>& operator++() { return *this; }
  back_insert_iterator<_Container>& operator++(int) { return *this; }
};

# 378 "/usr/include/g++-3/stl_iterator.h" 3


template <class _Container>
inline back_insert_iterator<_Container> back_inserter(_Container& __x) {
  return back_insert_iterator<_Container>(__x);
}

template <class _Container>
class front_insert_iterator {
protected:
  _Container* container;
public:
  typedef _Container          container_type;
  typedef output_iterator_tag iterator_category;
  typedef void                value_type;
  typedef void                difference_type;
  typedef void                pointer;
  typedef void                reference;

  explicit front_insert_iterator(_Container& __x) : container(&__x) {}
  front_insert_iterator<_Container>&
  operator=(const typename _Container::value_type& __value) { 
    container->push_front(__value);
    return *this;
  }
  front_insert_iterator<_Container>& operator*() { return *this; }
  front_insert_iterator<_Container>& operator++() { return *this; }
  front_insert_iterator<_Container>& operator++(int) { return *this; }
};

# 417 "/usr/include/g++-3/stl_iterator.h" 3


template <class _Container>
inline front_insert_iterator<_Container> front_inserter(_Container& __x) {
  return front_insert_iterator<_Container>(__x);
}

template <class _Container>
class insert_iterator {
protected:
  _Container* container;
  typename _Container::iterator iter;
public:
  typedef _Container          container_type;
  typedef output_iterator_tag iterator_category;
  typedef void                value_type;
  typedef void                difference_type;
  typedef void                pointer;
  typedef void                reference;

  insert_iterator(_Container& __x, typename _Container::iterator __i) 
    : container(&__x), iter(__i) {}
  insert_iterator<_Container>&
  operator=(const typename _Container::value_type& __value) { 
    iter = container->insert(iter, __value);
    ++iter;
    return *this;
  }
  insert_iterator<_Container>& operator*() { return *this; }
  insert_iterator<_Container>& operator++() { return *this; }
  insert_iterator<_Container>& operator++(int) { return *this; }
};

# 459 "/usr/include/g++-3/stl_iterator.h" 3


template <class _Container, class _Iterator>
inline 
insert_iterator<_Container> inserter(_Container& __x, _Iterator __i)
{
  typedef typename _Container::iterator __iter;
  return insert_iterator<_Container>(__x, __iter(__i));
}


template <class _BidirectionalIterator, class _Tp, class _Reference = _Tp&, 
          class _Distance = ptrdiff_t> 




class reverse_bidirectional_iterator {
  typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, 
                                         _Reference, _Distance>  _Self;
protected:
  _BidirectionalIterator current;
public:
  typedef bidirectional_iterator_tag iterator_category;
  typedef _Tp                        value_type;
  typedef _Distance                  difference_type;
  typedef _Tp*                       pointer;
  typedef _Reference                 reference;

  reverse_bidirectional_iterator() {}
  explicit reverse_bidirectional_iterator(_BidirectionalIterator __x)
    : current(__x) {}
  _BidirectionalIterator base() const { return current; }
  _Reference operator*() const {
    _BidirectionalIterator __tmp = current;
    return *--__tmp;
  }

  pointer operator->() const { return &(operator*()); }

  _Self& operator++() {
    --current;
    return *this;
  }
  _Self operator++(int) {
    _Self __tmp = *this;
    --current;
    return __tmp;
  }
  _Self& operator--() {
    ++current;
    return *this;
  }
  _Self operator--(int) {
    _Self __tmp = *this;
    ++current;
    return __tmp;
  }
};

# 550 "/usr/include/g++-3/stl_iterator.h" 3


template <class _BiIter, class _Tp, class _Ref,
          class _Distance>
inline bool operator==(
    const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __x, 
    const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __y)
{
  return __x.base() == __y.base();
}



 
 
 
 
 

template <class _Iterator>
class reverse_iterator 
{
protected:
  _Iterator current;
public:
  typedef typename iterator_traits<_Iterator>::iterator_category
          iterator_category;
  typedef typename iterator_traits<_Iterator>::value_type
          value_type;
  typedef typename iterator_traits<_Iterator>::difference_type
          difference_type;
  typedef typename iterator_traits<_Iterator>::pointer
          pointer;
  typedef typename iterator_traits<_Iterator>::reference
          reference;

  typedef _Iterator iterator_type;
  typedef reverse_iterator<_Iterator> _Self;

public:
  reverse_iterator() {}
  explicit reverse_iterator(iterator_type __x) : current(__x) {}

  reverse_iterator(const _Self& __x) : current(__x.current) {}

  template <class _Iter>
  reverse_iterator(const reverse_iterator<_Iter>& __x)
    : current(__x.base()) {}

    
  iterator_type base() const { return current; }
  reference operator*() const {
    _Iterator __tmp = current;
    return *--__tmp;
  }

  pointer operator->() const { return &(operator*()); }


  _Self& operator++() {
    --current;
    return *this;
  }
  _Self operator++(int) {
    _Self __tmp = *this;
    --current;
    return __tmp;
  }
  _Self& operator--() {
    ++current;
    return *this;
  }
  _Self operator--(int) {
    _Self __tmp = *this;
    ++current;
    return __tmp;
  }

  _Self operator+(difference_type __n) const {
    return _Self(current - __n);
  }
  _Self& operator+=(difference_type __n) {
    current -= __n;
    return *this;
  }
  _Self operator-(difference_type __n) const {
    return _Self(current + __n);
  }
  _Self& operator-=(difference_type __n) {
    current += __n;
    return *this;
  }
  reference operator[](difference_type __n) const { return *(*this + __n); }  
}; 
 
template <class _Iterator>
inline bool operator==(const reverse_iterator<_Iterator>& __x, 
                       const reverse_iterator<_Iterator>& __y) {
  return __x.base() == __y.base();
}

template <class _Iterator>
inline bool operator<(const reverse_iterator<_Iterator>& __x, 
                      const reverse_iterator<_Iterator>& __y) {
  return __y.base() < __x.base();
}

template <class _Iterator>
inline typename reverse_iterator<_Iterator>::difference_type
operator-(const reverse_iterator<_Iterator>& __x, 
          const reverse_iterator<_Iterator>& __y) {
  return __y.base() - __x.base();
}

template <class _Iterator>
inline reverse_iterator<_Iterator> 
operator+(typename reverse_iterator<_Iterator>::difference_type __n,
          const reverse_iterator<_Iterator>& __x) {
  return reverse_iterator<_Iterator>(__x.base() - __n);
}

# 805 "/usr/include/g++-3/stl_iterator.h" 3


 
 

template <class _Tp, class _Dist = ptrdiff_t> 
class istream_iterator {
  friend bool operator== <>  (const istream_iterator&,
                                               const istream_iterator&);
protected:
  istream* _M_stream;
  _Tp _M_value;
  bool _M_end_marker;
  void _M_read() {
    _M_end_marker = (*_M_stream) ? true : false;
    if (_M_end_marker) *_M_stream >> _M_value;
    _M_end_marker = (*_M_stream) ? true : false;
  }
public:
  typedef input_iterator_tag  iterator_category;
  typedef _Tp                 value_type;
  typedef _Dist               difference_type;
  typedef const _Tp*          pointer;
  typedef const _Tp&          reference;

  istream_iterator() : _M_stream(&cin), _M_end_marker(false) {}
  istream_iterator(istream& __s) : _M_stream(&__s) { _M_read(); }
  reference operator*() const { return _M_value; }

  pointer operator->() const { return &(operator*()); }

  istream_iterator<_Tp, _Dist>& operator++() { 
    _M_read(); 
    return *this;
  }
  istream_iterator<_Tp, _Dist> operator++(int)  {
    istream_iterator<_Tp, _Dist> __tmp = *this;
    _M_read();
    return __tmp;
  }
};

# 864 "/usr/include/g++-3/stl_iterator.h" 3


template <class _Tp, class _Distance>
inline bool operator==(const istream_iterator<_Tp, _Distance>& __x,
                       const istream_iterator<_Tp, _Distance>& __y) {
  return (__x._M_stream == __y._M_stream &&
          __x._M_end_marker == __y._M_end_marker) ||
         __x._M_end_marker == false && __y._M_end_marker == false;
}

template <class _Tp>
class ostream_iterator {
protected:
  ostream* _M_stream;
  const char* _M_string;
public:
  typedef output_iterator_tag iterator_category;
  typedef void                value_type;
  typedef void                difference_type;
  typedef void                pointer;
  typedef void                reference;

  ostream_iterator(ostream& __s) : _M_stream(&__s), _M_string(0) {}
  ostream_iterator(ostream& __s, const char* __c) 
    : _M_stream(&__s), _M_string(__c)  {}
  ostream_iterator<_Tp>& operator=(const _Tp& __value) { 
    *_M_stream << __value;
    if (_M_string) *_M_stream << _M_string;
    return *this;
  }
  ostream_iterator<_Tp>& operator*() { return *this; }
  ostream_iterator<_Tp>& operator++() { return *this; } 
  ostream_iterator<_Tp>& operator++(int) { return *this; } 
};

# 907 "/usr/include/g++-3/stl_iterator.h" 3


 



 
 
 
# 56 "/usr/include/g++-3/stl_algobase.h" 2 3



 

 

template <class _ForwardIter1, class _ForwardIter2, class _Tp>
inline void __iter_swap(_ForwardIter1 __a, _ForwardIter2 __b, _Tp*) {
  _Tp __tmp = *__a;
  *__a = *__b;
  *__b = __tmp;
}

template <class _ForwardIter1, class _ForwardIter2>
inline void iter_swap(_ForwardIter1 __a, _ForwardIter2 __b) {
  __iter_swap(__a, __b, __value_type( __a ) );
}

template <class _Tp>
inline void swap(_Tp& __a, _Tp& __b) {
  _Tp __tmp = __a;
  __a = __b;
  __b = __tmp;
}

 
 






template <class _Tp>
inline const _Tp& min(const _Tp& __a, const _Tp& __b) {
  return __b < __a ? __b : __a;
}

template <class _Tp>
inline const _Tp& max(const _Tp& __a, const _Tp& __b) {
  return  __a < __b ? __b : __a;
}



template <class _Tp, class _Compare>
inline const _Tp& min(const _Tp& __a, const _Tp& __b, _Compare __comp) {
  return __comp(__b, __a) ? __b : __a;
}

template <class _Tp, class _Compare>
inline const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) {
  return __comp(__a, __b) ? __b : __a;
}

 
 

 
 
 
 
 
 
 

template <class _InputIter, class _OutputIter, class _Distance>
inline _OutputIter __copy(_InputIter __first, _InputIter __last,
                          _OutputIter __result,
                          input_iterator_tag, _Distance*)
{
  for ( ; __first != __last; ++__result, ++__first)
    *__result = *__first;
  return __result;
}

template <class _RandomAccessIter, class _OutputIter, class _Distance>
inline _OutputIter
__copy(_RandomAccessIter __first, _RandomAccessIter __last,
       _OutputIter __result, random_access_iterator_tag, _Distance*)
{
  for (_Distance __n = __last - __first; __n > 0; --__n) {
    *__result = *__first;
    ++__first;
    ++__result;
  }
  return __result;
}

template <class _Tp>
inline _Tp*
__copy_trivial(const _Tp* __first, const _Tp* __last, _Tp* __result) {
  memmove(__result, __first, sizeof(_Tp) * (__last - __first));
  return __result + (__last - __first);
}



template <class _InputIter, class _OutputIter, class _BoolType>
struct __copy_dispatch {
  static _OutputIter copy(_InputIter __first, _InputIter __last,
                          _OutputIter __result) {
    typedef typename iterator_traits<_InputIter>::iterator_category _Category;
    typedef typename iterator_traits<_InputIter>::difference_type _Distance;
    return __copy(__first, __last, __result, _Category(), (_Distance*) 0);
  }
};

template <class _Tp>
struct __copy_dispatch<_Tp*, _Tp*, __true_type>
{
  static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
    return __copy_trivial(__first, __last, __result);
  }
};

template <class _Tp>
struct __copy_dispatch<const _Tp*, _Tp*, __true_type>
{
  static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
    return __copy_trivial(__first, __last, __result);
  }
};

template <class _InputIter, class _OutputIter>
inline _OutputIter copy(_InputIter __first, _InputIter __last,
                        _OutputIter __result) {
  typedef typename iterator_traits<_InputIter>::value_type _Tp;
  typedef typename __type_traits<_Tp>::has_trivial_assignment_operator
          _Trivial;
  return __copy_dispatch<_InputIter, _OutputIter, _Trivial>
    ::copy(__first, __last, __result);
}

# 213 "/usr/include/g++-3/stl_algobase.h" 3


 
 

template <class _BidirectionalIter1, class _BidirectionalIter2, 
          class _Distance>
inline _BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first, 
                                           _BidirectionalIter1 __last, 
                                           _BidirectionalIter2 __result,
                                           bidirectional_iterator_tag,
                                           _Distance*)
{
  while (__first != __last)
    *--__result = *--__last;
  return __result;
}

template <class _RandomAccessIter, class _BidirectionalIter, class _Distance>
inline _BidirectionalIter __copy_backward(_RandomAccessIter __first, 
                                          _RandomAccessIter __last, 
                                          _BidirectionalIter __result,
                                          random_access_iterator_tag,
                                          _Distance*)
{
  for (_Distance __n = __last - __first; __n > 0; --__n)
    *--__result = *--__last;
  return __result;
}



 
 
 
 

template <class _BidirectionalIter1, class _BidirectionalIter2,
          class _BoolType>
struct __copy_backward_dispatch
{
  typedef typename iterator_traits<_BidirectionalIter1>::iterator_category 
          _Cat;
  typedef typename iterator_traits<_BidirectionalIter1>::difference_type
          _Distance;

  static _BidirectionalIter2 copy(_BidirectionalIter1 __first, 
                                  _BidirectionalIter1 __last, 
                                  _BidirectionalIter2 __result) {
    return __copy_backward(__first, __last, __result, _Cat(), (_Distance*) 0);
  }
};

template <class _Tp>
struct __copy_backward_dispatch<_Tp*, _Tp*, __true_type>
{
  static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
    const ptrdiff_t _Num = __last - __first;
    memmove(__result - _Num, __first, sizeof(_Tp) * _Num);
    return __result - _Num;
  }
};

template <class _Tp>
struct __copy_backward_dispatch<const _Tp*, _Tp*, __true_type>
{
  static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
    return  __copy_backward_dispatch<_Tp*, _Tp*, __true_type>
      ::copy(__first, __last, __result);
  }
};

template <class _BI1, class _BI2>
inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) {
  typedef typename __type_traits<typename iterator_traits<_BI2>::value_type>
                        ::has_trivial_assignment_operator
          _Trivial;
  return __copy_backward_dispatch<_BI1, _BI2, _Trivial>
              ::copy(__first, __last, __result);
}

# 303 "/usr/include/g++-3/stl_algobase.h" 3


 
 

template <class _InputIter, class _Size, class _OutputIter>
pair<_InputIter, _OutputIter> __copy_n(_InputIter __first, _Size __count,
                                       _OutputIter __result,
                                       input_iterator_tag) {
  for ( ; __count > 0; --__count) {
    *__result = *__first;
    ++__first;
    ++__result;
  }
  return pair<_InputIter, _OutputIter>(__first, __result);
}

template <class _RAIter, class _Size, class _OutputIter>
inline pair<_RAIter, _OutputIter>
__copy_n(_RAIter __first, _Size __count,
         _OutputIter __result,
         random_access_iterator_tag) {
  _RAIter __last = __first + __count;
  return pair<_RAIter, _OutputIter>(__last, copy(__first, __last, __result));
}

template <class _InputIter, class _Size, class _OutputIter>
inline pair<_InputIter, _OutputIter>
__copy_n(_InputIter __first, _Size __count, _OutputIter __result) {
  return __copy_n(__first, __count, __result,
                  __iterator_category( __first ) );
}

template <class _InputIter, class _Size, class _OutputIter>
inline pair<_InputIter, _OutputIter>
copy_n(_InputIter __first, _Size __count, _OutputIter __result) {
  return __copy_n(__first, __count, __result);
}

 
 


template <class _ForwardIter, class _Tp>
void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __value) {
  for ( ; __first != __last; ++__first)
    *__first = __value;
}

template <class _OutputIter, class _Size, class _Tp>
_OutputIter fill_n(_OutputIter __first, _Size __n, const _Tp& __value) {
  for ( ; __n > 0; --__n, ++__first)
    *__first = __value;
  return __first;
}

 
 

template <class _InputIter1, class _InputIter2>
pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
                                        _InputIter1 __last1,
                                        _InputIter2 __first2) {
  while (__first1 != __last1 && *__first1 == *__first2) {
    ++__first1;
    ++__first2;
  }
  return pair<_InputIter1, _InputIter2>(__first1, __first2);
}

template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
                                        _InputIter1 __last1,
                                        _InputIter2 __first2,
                                        _BinaryPredicate __binary_pred) {
  while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) {
    ++__first1;
    ++__first2;
  }
  return pair<_InputIter1, _InputIter2>(__first1, __first2);
}

template <class _InputIter1, class _InputIter2>
inline bool equal(_InputIter1 __first1, _InputIter1 __last1,
                  _InputIter2 __first2) {
  for ( ; __first1 != __last1; ++__first1, ++__first2)
    if (*__first1 != *__first2)
      return false;
  return true;
}

template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
inline bool equal(_InputIter1 __first1, _InputIter1 __last1,
                  _InputIter2 __first2, _BinaryPredicate __binary_pred) {
  for ( ; __first1 != __last1; ++__first1, ++__first2)
    if (!__binary_pred(*__first1, *__first2))
      return false;
  return true;
}

 
 
 

template <class _InputIter1, class _InputIter2>
bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
                             _InputIter2 __first2, _InputIter2 __last2) {
  for ( ; __first1 != __last1 && __first2 != __last2
        ; ++__first1, ++__first2) {
    if (*__first1 < *__first2)
      return true;
    if (*__first2 < *__first1)
      return false;
  }
  return __first1 == __last1 && __first2 != __last2;
}

template <class _InputIter1, class _InputIter2, class _Compare>
bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
                             _InputIter2 __first2, _InputIter2 __last2,
                             _Compare __comp) {
  for ( ; __first1 != __last1 && __first2 != __last2
        ; ++__first1, ++__first2) {
    if (__comp(*__first1, *__first2))
      return true;
    if (__comp(*__first2, *__first1))
      return false;
  }
  return __first1 == __last1 && __first2 != __last2;
}

inline bool 
lexicographical_compare(const unsigned char* __first1,
                        const unsigned char* __last1,
                        const unsigned char* __first2,
                        const unsigned char* __last2)
{
  const size_t __len1 = __last1 - __first1;
  const size_t __len2 = __last2 - __first2;
  const int __result = memcmp(__first1, __first2, min(__len1, __len2));
  return __result != 0 ? __result < 0 : __len1 < __len2;
}

inline bool lexicographical_compare(const char* __first1, const char* __last1,
                                    const char* __first2, const char* __last2)
{

  return lexicographical_compare((const signed char*) __first1,
                                 (const signed char*) __last1,
                                 (const signed char*) __first2,
                                 (const signed char*) __last2);






}

template <class _InputIter1, class _InputIter2>
int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
                                   _InputIter2 __first2, _InputIter2 __last2)
{
  while (__first1 != __last1 && __first2 != __last2) {
    if (*__first1 < *__first2)
      return -1;
    if (*__first2 < *__first1)
      return 1;
    ++__first1;
    ++__first2;
  }
  if (__first2 == __last2) {
    return !(__first1 == __last1);
  }
  else {
    return -1;
  }
}

inline int
__lexicographical_compare_3way(const unsigned char* __first1,
                               const unsigned char* __last1,
                               const unsigned char* __first2,
                               const unsigned char* __last2)
{
  const ptrdiff_t __len1 = __last1 - __first1;
  const ptrdiff_t __len2 = __last2 - __first2;
  const int __result = memcmp(__first1, __first2, min(__len1, __len2));
  return __result != 0 ? __result 
                       : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1));
}

inline int 
__lexicographical_compare_3way(const char* __first1, const char* __last1,
                               const char* __first2, const char* __last2)
{

  return __lexicographical_compare_3way(
                                (const signed char*) __first1,
                                (const signed char*) __last1,
                                (const signed char*) __first2,
                                (const signed char*) __last2);






}

template <class _InputIter1, class _InputIter2>
int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
                                 _InputIter2 __first2, _InputIter2 __last2)
{
  return __lexicographical_compare_3way(__first1, __last1, __first2, __last2);
}

 



 
 
 
# 30 "/usr/include/g++-3/list" 2 3

# 1 "/usr/include/g++-3/stl_alloc.h" 1 3
 












 



















 
 
 
 
 
 













# 1 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 1 3
# 345 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3

# 53 "/usr/include/g++-3/stl_alloc.h" 2 3



# 1 "/usr/include/assert.h" 1 3
 




extern "C" {


















void __attribute__((__cdecl__))   __assert   (const char *, int, const char *)  ;


}

# 56 "/usr/include/g++-3/stl_alloc.h" 2 3











# 78 "/usr/include/g++-3/stl_alloc.h" 3

# 87 "/usr/include/g++-3/stl_alloc.h" 3

# 97 "/usr/include/g++-3/stl_alloc.h" 3

# 115 "/usr/include/g++-3/stl_alloc.h" 3


 






 





 
 









template <int __inst>
class __malloc_alloc_template {

private:

  static void* _S_oom_malloc(size_t);
  static void* _S_oom_realloc(void*, size_t);


  static void (* __malloc_alloc_oom_handler)();


public:

  static void* allocate(size_t __n)
  {
    void* __result = malloc(__n);
    if (0 == __result) __result = _S_oom_malloc(__n);
    return __result;
  }

  static void deallocate(void* __p, size_t  )
  {
    free(__p);
  }

  static void* reallocate(void* __p, size_t  , size_t __new_sz)
  {
    void* __result = realloc(__p, __new_sz);
    if (0 == __result) __result = _S_oom_realloc(__p, __new_sz);
    return __result;
  }

  static void (* __set_malloc_handler(void (*__f)()))()
  {
    void (* __old)() = __malloc_alloc_oom_handler;
    __malloc_alloc_oom_handler = __f;
    return(__old);
  }

};

 


template <int __inst>
void (* __malloc_alloc_template<__inst>::__malloc_alloc_oom_handler)() = 0;


template <int __inst>
void*
__malloc_alloc_template<__inst>::_S_oom_malloc(size_t __n)
{
    void (* __my_malloc_handler)();
    void* __result;

    for (;;) {
        __my_malloc_handler = __malloc_alloc_oom_handler;
        if (0 == __my_malloc_handler) { cerr << "out of memory" << endl; exit(1) ; }
        (*__my_malloc_handler)();
        __result = malloc(__n);
        if (__result) return(__result);
    }
}

template <int __inst>
void* __malloc_alloc_template<__inst>::_S_oom_realloc(void* __p, size_t __n)
{
    void (* __my_malloc_handler)();
    void* __result;

    for (;;) {
        __my_malloc_handler = __malloc_alloc_oom_handler;
        if (0 == __my_malloc_handler) { cerr << "out of memory" << endl; exit(1) ; }
        (*__my_malloc_handler)();
        __result = realloc(__p, __n);
        if (__result) return(__result);
    }
}

typedef __malloc_alloc_template<0> malloc_alloc;

template<class _Tp, class _Alloc>
class simple_alloc {

public:
    static _Tp* allocate(size_t __n)
      { return 0 == __n ? 0 : (_Tp*) _Alloc::allocate(__n * sizeof (_Tp)); }
    static _Tp* allocate(void)
      { return (_Tp*) _Alloc::allocate(sizeof (_Tp)); }
    static void deallocate(_Tp* __p, size_t __n)
      { if (0 != __n) _Alloc::deallocate(__p, __n * sizeof (_Tp)); }
    static void deallocate(_Tp* __p)
      { _Alloc::deallocate(__p, sizeof (_Tp)); }
};

 
 
 
 
 
template <class _Alloc>
class debug_alloc {

private:

  enum {_S_extra = 8};   
                         
                         

public:

  static void* allocate(size_t __n)
  {
    char* __result = (char*)_Alloc::allocate(__n + _S_extra);
    *(size_t*)__result = __n;
    return __result + _S_extra;
  }

  static void deallocate(void* __p, size_t __n)
  {
    char* __real_p = (char*)__p - _S_extra;
    (( *(size_t*)__real_p == __n ) ? (void)0 : __assert("/usr/include/g++-3/stl_alloc.h", 263, "*(size_t*)__real_p == __n")) ;
    _Alloc::deallocate(__real_p, __n + _S_extra);
  }

  static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz)
  {
    char* __real_p = (char*)__p - _S_extra;
    (( *(size_t*)__real_p == __old_sz ) ? (void)0 : __assert("/usr/include/g++-3/stl_alloc.h", 270, "*(size_t*)__real_p == __old_sz")) ;
    char* __result = (char*)
      _Alloc::reallocate(__real_p, __old_sz + _S_extra, __new_sz + _S_extra);
    *(size_t*)__result = __new_sz;
    return __result + _S_extra;
  }

};










 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 







template <bool threads, int inst>
class __default_alloc_template {

private:
   
   

    enum {_ALIGN = 8};
    enum {_MAX_BYTES = 128};
    enum {_NFREELISTS = _MAX_BYTES/_ALIGN};

  static size_t
  _S_round_up(size_t __bytes)
    { return (((__bytes) + _ALIGN-1) & ~(_ALIGN - 1)); }

private :
  union _Obj {
        union _Obj* _M_free_list_link;
        char _M_client_data[1];     
  };
private:




    static _Obj*   _S_free_list[_NFREELISTS];

  static  size_t _S_freelist_index(size_t __bytes) {
        return (((__bytes) + _ALIGN-1)/_ALIGN - 1);
  }

   
  static void* _S_refill(size_t __n);
   
   
  static char* _S_chunk_alloc(size_t __size, int& __nobjs);

   
  static char* _S_start_free;
  static char* _S_end_free;
  static size_t _S_heap_size;















# 389 "/usr/include/g++-3/stl_alloc.h" 3


    class _Lock {
        public:
            _Lock() {  ; }
            ~_Lock() {  ; }
    };
    friend class _Lock;

public:

   
  static void* allocate(size_t __n)
  {
    _Obj*  * __my_free_list;
    _Obj*   __result;

    if (__n > (size_t) _MAX_BYTES) {
        return(malloc_alloc::allocate(__n));
    }
    __my_free_list = _S_free_list + _S_freelist_index(__n);
     
     
     




    __result = *__my_free_list;
    if (__result == 0) {
        void* __r = _S_refill(_S_round_up(__n));
        return __r;
    }
    *__my_free_list = __result -> _M_free_list_link;
    return (__result);
  };

   
  static void deallocate(void* __p, size_t __n)
  {
    _Obj* __q = (_Obj*)__p;
    _Obj*  * __my_free_list;

    if (__n > (size_t) _MAX_BYTES) {
        malloc_alloc::deallocate(__p, __n);
        return;
    }
    __my_free_list = _S_free_list + _S_freelist_index(__n);
     




    __q -> _M_free_list_link = *__my_free_list;
    *__my_free_list = __q;
     
  }

  static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz);

} ;

typedef __default_alloc_template< false , 0> alloc;
typedef __default_alloc_template<false, 0> single_client_alloc;



 
 
 
 
template <bool __threads, int __inst>
char*
__default_alloc_template<__threads, __inst>::_S_chunk_alloc(size_t __size,
                                                            int& __nobjs)
{
    char* __result;
    size_t __total_bytes = __size * __nobjs;
    size_t __bytes_left = _S_end_free - _S_start_free;

    if (__bytes_left >= __total_bytes) {
        __result = _S_start_free;
        _S_start_free += __total_bytes;
        return(__result);
    } else if (__bytes_left >= __size) {
        __nobjs = (int)(__bytes_left/__size);
        __total_bytes = __size * __nobjs;
        __result = _S_start_free;
        _S_start_free += __total_bytes;
        return(__result);
    } else {
        size_t __bytes_to_get =
	  2 * __total_bytes + _S_round_up(_S_heap_size >> 4);
         
        if (__bytes_left > 0) {
            _Obj*  * __my_free_list =
                        _S_free_list + _S_freelist_index(__bytes_left);

            ((_Obj*)_S_start_free) -> _M_free_list_link = *__my_free_list;
            *__my_free_list = (_Obj*)_S_start_free;
        }
        _S_start_free = (char*)malloc(__bytes_to_get);
        if (0 == _S_start_free) {
            size_t __i;
            _Obj*  * __my_free_list;
	    _Obj* __p;
             
             
             
            for (__i = __size; __i <= _MAX_BYTES; __i += _ALIGN) {
                __my_free_list = _S_free_list + _S_freelist_index(__i);
                __p = *__my_free_list;
                if (0 != __p) {
                    *__my_free_list = __p -> _M_free_list_link;
                    _S_start_free = (char*)__p;
                    _S_end_free = _S_start_free + __i;
                    return(_S_chunk_alloc(__size, __nobjs));
                     
                     
                }
            }
	    _S_end_free = 0;	 
            _S_start_free = (char*)malloc_alloc::allocate(__bytes_to_get);
             
             
             
        }
        _S_heap_size += __bytes_to_get;
        _S_end_free = _S_start_free + __bytes_to_get;
        return(_S_chunk_alloc(__size, __nobjs));
    }
}


 
 
 
template <bool __threads, int __inst>
void*
__default_alloc_template<__threads, __inst>::_S_refill(size_t __n)
{
    int __nobjs = 20;
    char* __chunk = _S_chunk_alloc(__n, __nobjs);
    _Obj*  * __my_free_list;
    _Obj* __result;
    _Obj* __current_obj;
    _Obj* __next_obj;
    int __i;

    if (1 == __nobjs) return(__chunk);
    __my_free_list = _S_free_list + _S_freelist_index(__n);

     
      __result = (_Obj*)__chunk;
      *__my_free_list = __next_obj = (_Obj*)(__chunk + __n);
      for (__i = 1; ; __i++) {
        __current_obj = __next_obj;
        __next_obj = (_Obj*)((char*)__next_obj + __n);
        if (__nobjs - 1 == __i) {
            __current_obj -> _M_free_list_link = 0;
            break;
        } else {
            __current_obj -> _M_free_list_link = __next_obj;
        }
      }
    return(__result);
}

template <bool threads, int inst>
void*
__default_alloc_template<threads, inst>::reallocate(void* __p,
                                                    size_t __old_sz,
                                                    size_t __new_sz)
{
    void* __result;
    size_t __copy_sz;

    if (__old_sz > (size_t) _MAX_BYTES && __new_sz > (size_t) _MAX_BYTES) {
        return(realloc(__p, __new_sz));
    }
    if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p);
    __result = allocate(__new_sz);
    __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
    memcpy(__result, __p, __copy_sz);
    deallocate(__p, __old_sz);
    return(__result);
}















# 602 "/usr/include/g++-3/stl_alloc.h" 3


# 689 "/usr/include/g++-3/stl_alloc.h" 3


template <bool __threads, int __inst>
char* __default_alloc_template<__threads, __inst>::_S_start_free = 0;

template <bool __threads, int __inst>
char* __default_alloc_template<__threads, __inst>::_S_end_free = 0;

template <bool __threads, int __inst>
size_t __default_alloc_template<__threads, __inst>::_S_heap_size = 0;

template <bool __threads, int __inst>
__default_alloc_template<__threads, __inst>::_Obj*  
__default_alloc_template<__threads, __inst> ::_S_free_list[
    _NFREELISTS
] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
 
 
 










 
 
 
 
 
 
 



template <class _Tp>
class allocator {
  typedef alloc _Alloc;           
public:
  typedef size_t     size_type;
  typedef ptrdiff_t  difference_type;
  typedef _Tp*       pointer;
  typedef const _Tp* const_pointer;
  typedef _Tp&       reference;
  typedef const _Tp& const_reference;
  typedef _Tp        value_type;

  template <class _Tp1> struct rebind {
    typedef allocator<_Tp1> other;
  };

  allocator() throw()  {}
  allocator(const allocator&) throw()  {}
  template <class _Tp1> allocator(const allocator<_Tp1>&) throw()  {}
  ~allocator() throw()  {}

  pointer address(reference __x) const { return &__x; }
  const_pointer address(const_reference __x) const { return &__x; }

   
   
  _Tp* allocate(size_type __n, const void* = 0) {
    return __n != 0 ? static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp)))
                    : 0;
  }

   
  void deallocate(pointer __p, size_type __n)
    { _Alloc::deallocate(__p, __n * sizeof(_Tp)); }

  size_type max_size() const throw() 
    { return size_t(-1) / sizeof(_Tp); }

  void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
  void destroy(pointer __p) { __p->~_Tp(); }
};

template<>
class allocator<void> {
  typedef size_t      size_type;
  typedef ptrdiff_t   difference_type;
  typedef void*       pointer;
  typedef const void* const_pointer;
  typedef void        value_type;

  template <class _Tp1> struct rebind {
    typedef allocator<_Tp1> other;
  };
};


template <class _T1, class _T2>
inline bool operator==(const allocator<_T1>&, const allocator<_T2>&)
{
  return true;
}

template <class _T1, class _T2>
inline bool operator!=(const allocator<_T1>&, const allocator<_T2>&)
{
  return false;
}

 
 
 
 
 
 

template <class _Tp, class _Alloc>
struct __allocator {
  _Alloc __underlying_alloc;

  typedef size_t    size_type;
  typedef ptrdiff_t difference_type;
  typedef _Tp*       pointer;
  typedef const _Tp* const_pointer;
  typedef _Tp&       reference;
  typedef const _Tp& const_reference;
  typedef _Tp        value_type;

  template <class _Tp1> struct rebind {
    typedef __allocator<_Tp1, _Alloc> other;
  };

  __allocator() throw()  {}
  __allocator(const __allocator& __a) throw() 
    : __underlying_alloc(__a.__underlying_alloc) {}
  template <class _Tp1>
  __allocator(const __allocator<_Tp1, _Alloc>& __a) throw() 
    : __underlying_alloc(__a.__underlying_alloc) {}
  ~__allocator() throw()  {}

  pointer address(reference __x) const { return &__x; }
  const_pointer address(const_reference __x) const { return &__x; }

   
  _Tp* allocate(size_type __n, const void* = 0) {
    return __n != 0
        ? static_cast<_Tp*>(__underlying_alloc.allocate(__n * sizeof(_Tp)))
        : 0;
  }

   
  void deallocate(pointer __p, size_type __n)
    { __underlying_alloc.deallocate(__p, __n * sizeof(_Tp)); }

  size_type max_size() const throw() 
    { return size_t(-1) / sizeof(_Tp); }

  void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
  void destroy(pointer __p) { __p->~_Tp(); }
};

template <class _Alloc>
class __allocator<void, _Alloc> {
  typedef size_t      size_type;
  typedef ptrdiff_t   difference_type;
  typedef void*       pointer;
  typedef const void* const_pointer;
  typedef void        value_type;

  template <class _Tp1> struct rebind {
    typedef __allocator<_Tp1, _Alloc> other;
  };
};

template <class _Tp, class _Alloc>
inline bool operator==(const __allocator<_Tp, _Alloc>& __a1,
                       const __allocator<_Tp, _Alloc>& __a2)
{
  return __a1.__underlying_alloc == __a2.__underlying_alloc;
}


template <class _Tp, class _Alloc>
inline bool operator!=(const __allocator<_Tp, _Alloc>& __a1,
                       const __allocator<_Tp, _Alloc>& __a2)
{
  return __a1.__underlying_alloc != __a2.__underlying_alloc;
}


 
 
 

template <int inst>
inline bool operator==(const __malloc_alloc_template<inst>&,
                       const __malloc_alloc_template<inst>&)
{
  return true;
}


template <int __inst>
inline bool operator!=(const __malloc_alloc_template<__inst>&,
                       const __malloc_alloc_template<__inst>&)
{
  return false;
}



template <bool __threads, int __inst>
inline bool operator==(const __default_alloc_template<__threads, __inst>&,
                       const __default_alloc_template<__threads, __inst>&)
{
  return true;
}


template <bool __threads, int __inst>
inline bool operator!=(const __default_alloc_template<__threads, __inst>&,
                       const __default_alloc_template<__threads, __inst>&)
{
  return false;
}



template <class _Alloc>
inline bool operator==(const debug_alloc<_Alloc>&,
                       const debug_alloc<_Alloc>&) {
  return true;
}


template <class _Alloc>
inline bool operator!=(const debug_alloc<_Alloc>&,
                       const debug_alloc<_Alloc>&) {
  return false;
}


 
 
 
 
 
 

 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 
 

 

template <class _Tp, class _Allocator>
struct _Alloc_traits
{
  static const bool _S_instanceless = false;
  typedef typename _Allocator::   rebind<_Tp>::other
          allocator_type;
};

template <class _Tp, class _Allocator>
const bool _Alloc_traits<_Tp, _Allocator>::_S_instanceless;

 

template <class _Tp, class _Tp1>
struct _Alloc_traits<_Tp, allocator<_Tp1> >
{
  static const bool _S_instanceless = true;
  typedef simple_alloc<_Tp, alloc> _Alloc_type;
  typedef allocator<_Tp> allocator_type;
};

 

template <class _Tp, int __inst>
struct _Alloc_traits<_Tp, __malloc_alloc_template<__inst> >
{
  static const bool _S_instanceless = true;
  typedef simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type;
  typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type;
};


template <class _Tp, bool __threads, int __inst>
struct _Alloc_traits<_Tp, __default_alloc_template<__threads, __inst> >
{
  static const bool _S_instanceless = true;
  typedef simple_alloc<_Tp, __default_alloc_template<__threads, __inst> >
          _Alloc_type;
  typedef __allocator<_Tp, __default_alloc_template<__threads, __inst> >
          allocator_type;
};


template <class _Tp, class _Alloc>
struct _Alloc_traits<_Tp, debug_alloc<_Alloc> >
{
  static const bool _S_instanceless = true;
  typedef simple_alloc<_Tp, debug_alloc<_Alloc> > _Alloc_type;
  typedef __allocator<_Tp, debug_alloc<_Alloc> > allocator_type;
};

 
 

template <class _Tp, class _Tp1, int __inst>
struct _Alloc_traits<_Tp,
                     __allocator<_Tp1, __malloc_alloc_template<__inst> > >
{
  static const bool _S_instanceless = true;
  typedef simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type;
  typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type;
};


template <class _Tp, class _Tp1, bool __thr, int __inst>
struct _Alloc_traits<_Tp,
                      __allocator<_Tp1,
                                  __default_alloc_template<__thr, __inst> > >
{
  static const bool _S_instanceless = true;
  typedef simple_alloc<_Tp, __default_alloc_template<__thr,__inst> >
          _Alloc_type;
  typedef __allocator<_Tp, __default_alloc_template<__thr,__inst> >
          allocator_type;
};


template <class _Tp, class _Tp1, class _Alloc>
struct _Alloc_traits<_Tp, __allocator<_Tp1, debug_alloc<_Alloc> > >
{
  static const bool _S_instanceless = true;
  typedef simple_alloc<_Tp, debug_alloc<_Alloc> > _Alloc_type;
  typedef __allocator<_Tp, debug_alloc<_Alloc> > allocator_type;
};








 





 
 
 
# 31 "/usr/include/g++-3/list" 2 3

# 1 "/usr/include/g++-3/stl_construct.h" 1 3
 

























 








 

 
 

template <class _Tp>
inline void destroy(_Tp* __pointer) {
  __pointer->~_Tp();
}

template <class _T1, class _T2>
inline void construct(_T1* __p, const _T2& __value) {
  new (__p) _T1(__value);
}

template <class _T1>
inline void construct(_T1* __p) {
  new (__p) _T1();
}

template <class _ForwardIterator>
inline void
__destroy_aux(_ForwardIterator __first, _ForwardIterator __last, __false_type)
{
  for ( ; __first != __last; ++__first)
    destroy(&*__first);
}

template <class _ForwardIterator>
inline void __destroy_aux(_ForwardIterator, _ForwardIterator, __true_type) {}

template <class _ForwardIterator, class _Tp>
inline void
__destroy(_ForwardIterator __first, _ForwardIterator __last, _Tp*)
{
  typedef typename __type_traits<_Tp>::has_trivial_destructor
          _Trivial_destructor;
  __destroy_aux(__first, __last, _Trivial_destructor());
}

template <class _ForwardIterator>
inline void destroy(_ForwardIterator __first, _ForwardIterator __last) {
  __destroy(__first, __last, __value_type( __first ) );
}

inline void destroy(char*, char*) {}
inline void destroy(wchar_t*, wchar_t*) {}

 



 
 
 
# 32 "/usr/include/g++-3/list" 2 3

# 1 "/usr/include/g++-3/stl_uninitialized.h" 1 3
 

























 






 

 

 
 
template <class _InputIter, class _ForwardIter>
inline _ForwardIter 
__uninitialized_copy_aux(_InputIter __first, _InputIter __last,
                         _ForwardIter __result,
                         __true_type)
{
  return copy(__first, __last, __result);
}

template <class _InputIter, class _ForwardIter>
_ForwardIter 
__uninitialized_copy_aux(_InputIter __first, _InputIter __last,
                         _ForwardIter __result,
                         __false_type)
{
  _ForwardIter __cur = __result;
  try  {
    for ( ; __first != __last; ++__first, ++__cur)
      construct(&*__cur, *__first);
    return __cur;
  }
  catch(...) {  destroy(__result, __cur) ; throw; } ;
}


template <class _InputIter, class _ForwardIter, class _Tp>
inline _ForwardIter
__uninitialized_copy(_InputIter __first, _InputIter __last,
                     _ForwardIter __result, _Tp*)
{
  typedef typename __type_traits<_Tp>::is_POD_type _Is_POD;
  return __uninitialized_copy_aux(__first, __last, __result, _Is_POD());
}

template <class _InputIter, class _ForwardIter>
inline _ForwardIter
  uninitialized_copy(_InputIter __first, _InputIter __last,
                     _ForwardIter __result)
{
  return __uninitialized_copy(__first, __last, __result,
                              __value_type( __result ) );
}

inline char* uninitialized_copy(const char* __first, const char* __last,
                                char* __result) {
  memmove(__result, __first, __last - __first);
  return __result + (__last - __first);
}

inline wchar_t* 
uninitialized_copy(const wchar_t* __first, const wchar_t* __last,
                   wchar_t* __result)
{
  memmove(__result, __first, sizeof(wchar_t) * (__last - __first));
  return __result + (__last - __first);
}

 

template <class _InputIter, class _Size, class _ForwardIter>
pair<_InputIter, _ForwardIter>
__uninitialized_copy_n(_InputIter __first, _Size __count,
                       _ForwardIter __result,
                       input_iterator_tag)
{
  _ForwardIter __cur = __result;
  try  {
    for ( ; __count > 0 ; --__count, ++__first, ++__cur) 
      construct(&*__cur, *__first);
    return pair<_InputIter, _ForwardIter>(__first, __cur);
  }
  catch(...) {  destroy(__result, __cur) ; throw; } ;
}

template <class _RandomAccessIter, class _Size, class _ForwardIter>
inline pair<_RandomAccessIter, _ForwardIter>
__uninitialized_copy_n(_RandomAccessIter __first, _Size __count,
                       _ForwardIter __result,
                       random_access_iterator_tag) {
  _RandomAccessIter __last = __first + __count;
  return pair<_RandomAccessIter, _ForwardIter>(
                 __last,
                 uninitialized_copy(__first, __last, __result));
}

template <class _InputIter, class _Size, class _ForwardIter>
inline pair<_InputIter, _ForwardIter>
__uninitialized_copy_n(_InputIter __first, _Size __count,
                     _ForwardIter __result) {
  return __uninitialized_copy_n(__first, __count, __result,
                                __iterator_category( __first ) );
}

template <class _InputIter, class _Size, class _ForwardIter>
inline pair<_InputIter, _ForwardIter>
uninitialized_copy_n(_InputIter __first, _Size __count,
                     _ForwardIter __result) {
  return __uninitialized_copy_n(__first, __count, __result,
                                __iterator_category( __first ) );
}

 
 
template <class _ForwardIter, class _Tp>
inline void
__uninitialized_fill_aux(_ForwardIter __first, _ForwardIter __last, 
                         const _Tp& __x, __true_type)
{
  fill(__first, __last, __x);
}

template <class _ForwardIter, class _Tp>
void
__uninitialized_fill_aux(_ForwardIter __first, _ForwardIter __last, 
                         const _Tp& __x, __false_type)
{
  _ForwardIter __cur = __first;
  try  {
    for ( ; __cur != __last; ++__cur)
      construct(&*__cur, __x);
  }
  catch(...) {  destroy(__first, __cur) ; throw; } ;
}

template <class _ForwardIter, class _Tp, class _Tp1>
inline void __uninitialized_fill(_ForwardIter __first, 
                                 _ForwardIter __last, const _Tp& __x, _Tp1*)
{
  typedef typename __type_traits<_Tp1>::is_POD_type _Is_POD;
  __uninitialized_fill_aux(__first, __last, __x, _Is_POD());
                   
}

template <class _ForwardIter, class _Tp>
inline void uninitialized_fill(_ForwardIter __first,
                               _ForwardIter __last, 
                               const _Tp& __x)
{
  __uninitialized_fill(__first, __last, __x, __value_type( __first ) );
}

 
 
template <class _ForwardIter, class _Size, class _Tp>
inline _ForwardIter
__uninitialized_fill_n_aux(_ForwardIter __first, _Size __n,
                           const _Tp& __x, __true_type)
{
  return fill_n(__first, __n, __x);
}

template <class _ForwardIter, class _Size, class _Tp>
_ForwardIter
__uninitialized_fill_n_aux(_ForwardIter __first, _Size __n,
                           const _Tp& __x, __false_type)
{
  _ForwardIter __cur = __first;
  try  {
    for ( ; __n > 0; --__n, ++__cur)
      construct(&*__cur, __x);
    return __cur;
  }
  catch(...) {  destroy(__first, __cur) ; throw; } ;
}

template <class _ForwardIter, class _Size, class _Tp, class _Tp1>
inline _ForwardIter 
__uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x, _Tp1*)
{
  typedef typename __type_traits<_Tp1>::is_POD_type _Is_POD;
  return __uninitialized_fill_n_aux(__first, __n, __x, _Is_POD());
}

template <class _ForwardIter, class _Size, class _Tp>
inline _ForwardIter 
uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x)
{
  return __uninitialized_fill_n(__first, __n, __x, __value_type( __first ) );
}

 
 

 
 
 
 

template <class _InputIter1, class _InputIter2, class _ForwardIter>
inline _ForwardIter
__uninitialized_copy_copy(_InputIter1 __first1, _InputIter1 __last1,
                          _InputIter2 __first2, _InputIter2 __last2,
                          _ForwardIter __result)
{
  _ForwardIter __mid = uninitialized_copy(__first1, __last1, __result);
  try  {
    return uninitialized_copy(__first2, __last2, __mid);
  }
  catch(...) {  destroy(__result, __mid) ; throw; } ;
}

 
 
 
template <class _ForwardIter, class _Tp, class _InputIter>
inline _ForwardIter 
__uninitialized_fill_copy(_ForwardIter __result, _ForwardIter __mid,
                          const _Tp& __x,
                          _InputIter __first, _InputIter __last)
{
  uninitialized_fill(__result, __mid, __x);
  try  {
    return uninitialized_copy(__first, __last, __mid);
  }
  catch(...) {  destroy(__result, __mid) ; throw; } ;
}

 
 
 
template <class _InputIter, class _ForwardIter, class _Tp>
inline void
__uninitialized_copy_fill(_InputIter __first1, _InputIter __last1,
                          _ForwardIter __first2, _ForwardIter __last2,
                          const _Tp& __x)
{
  _ForwardIter __mid2 = uninitialized_copy(__first1, __last1, __first2);
  try  {
    uninitialized_fill(__mid2, __last2, __x);
  }
  catch(...) {  destroy(__first2, __mid2) ; throw; } ;
}

 



 
 
 
# 33 "/usr/include/g++-3/list" 2 3

# 1 "/usr/include/g++-3/stl_list.h" 1 3
 

























 






 






template <class _Tp>
struct _List_node {
  typedef void* _Void_pointer;
  _Void_pointer _M_next;
  _Void_pointer _M_prev;
  _Tp _M_data;
};

template<class _Tp, class _Ref, class _Ptr>
struct _List_iterator {
  typedef _List_iterator<_Tp,_Tp&,_Tp*>             iterator;
  typedef _List_iterator<_Tp,const _Tp&,const _Tp*> const_iterator;
  typedef _List_iterator<_Tp,_Ref,_Ptr>             _Self;

  typedef bidirectional_iterator_tag iterator_category;
  typedef _Tp value_type;
  typedef _Ptr pointer;
  typedef _Ref reference;
  typedef _List_node<_Tp> _Node;
  typedef size_t size_type;
  typedef ptrdiff_t difference_type;

  _Node* _M_node;

  _List_iterator(_Node* __x) : _M_node(__x) {}
  _List_iterator() {}
  _List_iterator(const iterator& __x) : _M_node(__x._M_node) {}

  bool operator==(const _Self& __x) const { return _M_node == __x._M_node; }
  bool operator!=(const _Self& __x) const { return _M_node != __x._M_node; }
  reference operator*() const { return (*_M_node)._M_data; }


  pointer operator->() const { return &(operator*()); }


  _Self& operator++() { 
    _M_node = (_Node*)(_M_node->_M_next);
    return *this;
  }
  _Self operator++(int) { 
    _Self __tmp = *this;
    ++*this;
    return __tmp;
  }
  _Self& operator--() { 
    _M_node = (_Node*)(_M_node->_M_prev);
    return *this;
  }
  _Self operator--(int) { 
    _Self __tmp = *this;
    --*this;
    return __tmp;
  }
};

# 120 "/usr/include/g++-3/stl_list.h" 3



 
 
 
 
 
 



 
template <class _Tp, class _Allocator, bool _IsStatic>
class _List_alloc_base {
public:
  typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
          allocator_type;
  allocator_type get_allocator() const { return _Node_allocator; }

  _List_alloc_base(const allocator_type& __a) : _Node_allocator(__a) {}

protected:
  _List_node<_Tp>* _M_get_node()
   { return _Node_allocator.allocate(1); }
  void _M_put_node(_List_node<_Tp>* __p)
    { _Node_allocator.deallocate(__p, 1); }

protected:
  typename _Alloc_traits<_List_node<_Tp>, _Allocator>::allocator_type
           _Node_allocator;
  _List_node<_Tp>* _M_node;
};

 

template <class _Tp, class _Allocator>
class _List_alloc_base<_Tp, _Allocator, true> {
public:
  typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
          allocator_type;
  allocator_type get_allocator() const { return allocator_type(); }

  _List_alloc_base(const allocator_type&) {}

protected:
  typedef typename _Alloc_traits<_List_node<_Tp>, _Allocator>::_Alloc_type
          _Alloc_type;
  _List_node<_Tp>* _M_get_node() { return _Alloc_type::allocate(1); }
  void _M_put_node(_List_node<_Tp>* __p) { _Alloc_type::deallocate(__p, 1); }

protected:
  _List_node<_Tp>* _M_node;
};

template <class _Tp, class _Alloc>
class _List_base 
  : public _List_alloc_base<_Tp, _Alloc,
                            _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
{
public:
  typedef _List_alloc_base<_Tp, _Alloc,
                           _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
          _Base; 
  typedef typename _Base::allocator_type allocator_type;

  _List_base(const allocator_type& __a) : _Base(__a) {
    _M_node = _M_get_node();
    _M_node->_M_next = _M_node;
    _M_node->_M_prev = _M_node;
  }
  ~_List_base() {
    clear();
    _M_put_node(_M_node);
  }

  void clear();
};

# 229 "/usr/include/g++-3/stl_list.h" 3


template <class _Tp, class _Alloc>
void 
_List_base<_Tp,_Alloc>::clear() 
{
  _List_node<_Tp>* __cur = (_List_node<_Tp>*) _M_node->_M_next;
  while (__cur != _M_node) {
    _List_node<_Tp>* __tmp = __cur;
    __cur = (_List_node<_Tp>*) __cur->_M_next;
    destroy(&__tmp->_M_data);
    _M_put_node(__tmp);
  }
  _M_node->_M_next = _M_node;
  _M_node->_M_prev = _M_node;
}

template <class _Tp, class _Alloc = allocator< _Tp >  >
class list : protected _List_base<_Tp, _Alloc> {
  typedef _List_base<_Tp, _Alloc> _Base;
protected:
  typedef void* _Void_pointer;

public:      
  typedef _Tp value_type;
  typedef value_type* pointer;
  typedef const value_type* const_pointer;
  typedef value_type& reference;
  typedef const value_type& const_reference;
  typedef _List_node<_Tp> _Node;
  typedef size_t size_type;
  typedef ptrdiff_t difference_type;

  typedef typename _Base::allocator_type allocator_type;
  allocator_type get_allocator() const { return _Base::get_allocator(); }

public:
  typedef _List_iterator<_Tp,_Tp&,_Tp*>             iterator;
  typedef _List_iterator<_Tp,const _Tp&,const _Tp*> const_iterator;


  typedef reverse_iterator<const_iterator> const_reverse_iterator;
  typedef reverse_iterator<iterator>       reverse_iterator;









protected:

  using _Base::_M_node;
  using _Base::_M_put_node;
  using _Base::_M_get_node;


protected:
  _Node* _M_create_node(const _Tp& __x)
  {
    _Node* __p = _M_get_node();
    try  {
      construct(&__p->_M_data, __x);
    }
    catch(...) {  _M_put_node(__p) ; throw; } ;
    return __p;
  }

  _Node* _M_create_node()
  {
    _Node* __p = _M_get_node();
    try  {
      construct(&__p->_M_data);
    }
    catch(...) {  _M_put_node(__p) ; throw; } ;
    return __p;
  }

public:
  explicit list(const allocator_type& __a = allocator_type()) : _Base(__a) {}

  iterator begin()             { return (_Node*)(_M_node->_M_next); }
  const_iterator begin() const { return (_Node*)(_M_node->_M_next); }

  iterator end()             { return _M_node; }
  const_iterator end() const { return _M_node; }

  reverse_iterator rbegin() 
    { return reverse_iterator(end()); }
  const_reverse_iterator rbegin() const 
    { return const_reverse_iterator(end()); }

  reverse_iterator rend()
    { return reverse_iterator(begin()); }
  const_reverse_iterator rend() const
    { return const_reverse_iterator(begin()); }

  bool empty() const { return _M_node->_M_next == _M_node; }
  size_type size() const {
    size_type __result = 0;
    distance(begin(), end(), __result);
    return __result;
  }
  size_type max_size() const { return size_type(-1); }

  reference front() { return *begin(); }
  const_reference front() const { return *begin(); }
  reference back() { return *(--end()); }
  const_reference back() const { return *(--end()); }

  void swap(list<_Tp, _Alloc>& __x) {  ::swap(_M_node, __x._M_node); }

  iterator insert(iterator __position, const _Tp& __x) {
    _Node* __tmp = _M_create_node(__x);
    __tmp->_M_next = __position._M_node;
    __tmp->_M_prev = __position._M_node->_M_prev;
    ((_Node*) (__position._M_node->_M_prev))->_M_next = __tmp;
    __position._M_node->_M_prev = __tmp;
    return __tmp;
  }
  iterator insert(iterator __position) { return insert(__position, _Tp()); }

   

  template<class _Integer>
  void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
                          __true_type) {
    insert(__pos, (size_type) __n, (_Tp) __x);
  }

  template <class _InputIterator>
  void _M_insert_dispatch(iterator __pos,
                          _InputIterator __first, _InputIterator __last,
                          __false_type);

  template <class _InputIterator>
  void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
    typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
    _M_insert_dispatch(__pos, __first, __last, _Integral());
  }






  void insert(iterator __pos, size_type __n, const _Tp& __x);
 
  void push_front(const _Tp& __x) { insert(begin(), __x); }
  void push_front() {insert(begin());}
  void push_back(const _Tp& __x) { insert(end(), __x); }
  void push_back() {insert(end());}

  iterator erase(iterator __position) {
    _Node* __next_node = (_Node*) (__position._M_node->_M_next);
    _Node* __prev_node = (_Node*) (__position._M_node->_M_prev);
    __prev_node->_M_next = __next_node;
    __next_node->_M_prev = __prev_node;
    destroy(&__position._M_node->_M_data);
    _M_put_node(__position._M_node);
    return iterator(__next_node);
  }
  iterator erase(iterator __first, iterator __last);
  void clear() { _Base::clear(); }

  void resize(size_type __new_size, const _Tp& __x);
  void resize(size_type __new_size) { resize(__new_size, _Tp()); }

  void pop_front() { erase(begin()); }
  void pop_back() { 
    iterator __tmp = end();
    erase(--__tmp);
  }
  list(size_type __n, const _Tp& __value,
       const allocator_type& __a = allocator_type())
    : _Base(__a)
    { insert(begin(), __n, __value); }
  explicit list(size_type __n)
    : _Base(allocator_type())
    { insert(begin(), __n, _Tp()); }



   
   
  template <class _InputIterator>
  list(_InputIterator __first, _InputIterator __last,
       const allocator_type& __a = allocator_type())
    : _Base(__a)
    { insert(begin(), __first, __last); }

# 433 "/usr/include/g++-3/stl_list.h" 3

  list(const list<_Tp, _Alloc>& __x) : _Base(__x.get_allocator())
    { insert(begin(), __x.begin(), __x.end()); }

  ~list() { }

  list<_Tp, _Alloc>& operator=(const list<_Tp, _Alloc>& __x);

public:
   
   
   
   

  void assign(size_type __n, const _Tp& __val);



  template <class _InputIterator>
  void assign(_InputIterator __first, _InputIterator __last) {
    typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
    _M_assign_dispatch(__first, __last, _Integral());
  }

  template <class _Integer>
  void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
    { assign((size_type) __n, (_Tp) __val); }

  template <class _InputIterator>
  void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
                          __false_type);



protected:
  void transfer(iterator __position, iterator __first, iterator __last) {
    if (__position != __last) {
       
      ((_Node*) (__last._M_node->_M_prev))->_M_next     = __position._M_node;
      ((_Node*) (__first._M_node->_M_prev))->_M_next    = __last._M_node;
      ((_Node*) (__position._M_node->_M_prev))->_M_next = __first._M_node; 

       
      _Node* __tmp = (_Node*) (__position._M_node->_M_prev);
      __position._M_node->_M_prev = __last._M_node->_M_prev;
      __last._M_node->_M_prev      = __first._M_node->_M_prev; 
      __first._M_node->_M_prev    = __tmp;
    }
  }

public:
  void splice(iterator __position, list& __x) {
    if (!__x.empty()) 
      transfer(__position, __x.begin(), __x.end());
  }
  void splice(iterator __position, list&, iterator __i) {
    iterator __j = __i;
    ++__j;
    if (__position == __i || __position == __j) return;
    transfer(__position, __i, __j);
  }
  void splice(iterator __position, list&, iterator __first, iterator __last) {
    if (__first != __last) 
      transfer(__position, __first, __last);
  }
  void remove(const _Tp& __value);
  void unique();
  void merge(list& __x);
  void reverse();
  void sort();


  template <class _Predicate> void remove_if(_Predicate);
  template <class _BinaryPredicate> void unique(_BinaryPredicate);
  template <class _StrictWeakOrdering> void merge(list&, _StrictWeakOrdering);
  template <class _StrictWeakOrdering> void sort(_StrictWeakOrdering);


  friend bool operator== <>  (
    const list& __x, const list& __y);
};

template <class _Tp, class _Alloc>
inline bool operator==(const list<_Tp,_Alloc>& __x,
                       const list<_Tp,_Alloc>& __y)
{
  typedef typename list<_Tp,_Alloc>::_Node _Node;
  _Node* __e1 = __x._M_node;
  _Node* __e2 = __y._M_node;
  _Node* __n1 = (_Node*) __e1->_M_next;
  _Node* __n2 = (_Node*) __e2->_M_next;
  for ( ; __n1 != __e1 && __n2 != __e2 ;
          __n1 = (_Node*) __n1->_M_next, __n2 = (_Node*) __n2->_M_next)
    if (__n1->_M_data != __n2->_M_data)
      return false;
  return __n1 == __e1 && __n2 == __e2;
}

template <class _Tp, class _Alloc>
inline bool operator<(const list<_Tp,_Alloc>& __x,
                      const list<_Tp,_Alloc>& __y)
{
  return lexicographical_compare(__x.begin(), __x.end(),
                                 __y.begin(), __y.end());
}



template <class _Tp, class _Alloc>
inline void 
swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
{
  __x.swap(__y);
}





template <class _Tp, class _Alloc> template <class _InputIter>
void 
list<_Tp, _Alloc>::_M_insert_dispatch(iterator __position,
                                      _InputIter __first, _InputIter __last,
                                      __false_type)
{
  for ( ; __first != __last; ++__first)
    insert(__position, *__first);
}

# 582 "/usr/include/g++-3/stl_list.h" 3


template <class _Tp, class _Alloc>
void 
list<_Tp, _Alloc>::insert(iterator __position, size_type __n, const _Tp& __x)
{
  for ( ; __n > 0; --__n)
    insert(__position, __x);
}

template <class _Tp, class _Alloc>
list<_Tp,_Alloc>::iterator list<_Tp, _Alloc>::erase(iterator __first, 
                                                    iterator __last)
{
  while (__first != __last)
    erase(__first++);
  return __last;
}

template <class _Tp, class _Alloc>
void list<_Tp, _Alloc>::resize(size_type __new_size, const _Tp& __x)
{
  iterator __i = begin();
  size_type __len = 0;
  for ( ; __i != end() && __len < __new_size; ++__i, ++__len)
    ;
  if (__len == __new_size)
    erase(__i, end());
  else                           
    insert(end(), __new_size - __len, __x);
}

template <class _Tp, class _Alloc>
list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(const list<_Tp, _Alloc>& __x)
{
  if (this != &__x) {
    iterator __first1 = begin();
    iterator __last1 = end();
    const_iterator __first2 = __x.begin();
    const_iterator __last2 = __x.end();
    while (__first1 != __last1 && __first2 != __last2) 
      *__first1++ = *__first2++;
    if (__first2 == __last2)
      erase(__first1, __last1);
    else
      insert(__last1, __first2, __last2);
  }
  return *this;
}

template <class _Tp, class _Alloc>
void list<_Tp, _Alloc>::assign(size_type __n, const _Tp& __val) {
  iterator __i = begin();
  for ( ; __i != end() && __n > 0; ++__i, --__n)
    *__i = __val;
  if (__n > 0)
    insert(end(), __n, __val);
  else
    erase(__i, end());
}



template <class _Tp, class _Alloc> template <class _InputIter>
void
list<_Tp, _Alloc>::_M_assign_dispatch(_InputIter __first2, _InputIter __last2,
                                      __false_type)
{
  iterator __first1 = begin();
  iterator __last1 = end();
  for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
    *__first1 = *__first2;
  if (__first2 == __last2)
    erase(__first1, __last1);
  else
    insert(__last1, __first2, __last2);
}



template <class _Tp, class _Alloc>
void list<_Tp, _Alloc>::remove(const _Tp& __value)
{
  iterator __first = begin();
  iterator __last = end();
  while (__first != __last) {
    iterator __next = __first;
    ++__next;
    if (*__first == __value) erase(__first);
    __first = __next;
  }
}

template <class _Tp, class _Alloc>
void list<_Tp, _Alloc>::unique()
{
  iterator __first = begin();
  iterator __last = end();
  if (__first == __last) return;
  iterator __next = __first;
  while (++__next != __last) {
    if (*__first == *__next)
      erase(__next);
    else
      __first = __next;
    __next = __first;
  }
}

template <class _Tp, class _Alloc>
void list<_Tp, _Alloc>::merge(list<_Tp, _Alloc>& __x)
{
  iterator __first1 = begin();
  iterator __last1 = end();
  iterator __first2 = __x.begin();
  iterator __last2 = __x.end();
  while (__first1 != __last1 && __first2 != __last2)
    if (*__first2 < *__first1) {
      iterator __next = __first2;
      transfer(__first1, __first2, ++__next);
      __first2 = __next;
    }
    else
      ++__first1;
  if (__first2 != __last2) transfer(__last1, __first2, __last2);
}

template <class _Tp, class _Alloc>
void list<_Tp, _Alloc>::reverse() 
{
   
  if (_M_node->_M_next != _M_node &&
      ((_Node*) (_M_node->_M_next))->_M_next != _M_node) {
    iterator __first = begin();
    ++__first;
    while (__first != end()) {
      iterator __old = __first;
      ++__first;
      transfer(begin(), __old, __first);
    }
  }
}    

template <class _Tp, class _Alloc>
void list<_Tp, _Alloc>::sort()
{
   
  if (_M_node->_M_next != _M_node &&
      ((_Node*) (_M_node->_M_next))->_M_next != _M_node) {
    list<_Tp, _Alloc> __carry;
    list<_Tp, _Alloc> __counter[64];
    int __fill = 0;
    while (!empty()) {
      __carry.splice(__carry.begin(), *this, begin());
      int __i = 0;
      while(__i < __fill && !__counter[__i].empty()) {
        __counter[__i].merge(__carry);
        __carry.swap(__counter[__i++]);
      }
      __carry.swap(__counter[__i]);         
      if (__i == __fill) ++__fill;
    } 

    for (int __i = 1; __i < __fill; ++__i)
      __counter[__i].merge(__counter[__i-1]);
    swap(__counter[__fill-1]);
  }
}



template <class _Tp, class _Alloc> template <class _Predicate>
void list<_Tp, _Alloc>::remove_if(_Predicate __pred)
{
  iterator __first = begin();
  iterator __last = end();
  while (__first != __last) {
    iterator __next = __first;
    ++__next;
    if (__pred(*__first)) erase(__first);
    __first = __next;
  }
}

template <class _Tp, class _Alloc> template <class _BinaryPredicate>
void list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
{
  iterator __first = begin();
  iterator __last = end();
  if (__first == __last) return;
  iterator __next = __first;
  while (++__next != __last) {
    if (__binary_pred(*__first, *__next))
      erase(__next);
    else
      __first = __next;
    __next = __first;
  }
}

template <class _Tp, class _Alloc> template <class _StrictWeakOrdering>
void list<_Tp, _Alloc>::merge(list<_Tp, _Alloc>& __x,
                              _StrictWeakOrdering __comp)
{
  iterator __first1 = begin();
  iterator __last1 = end();
  iterator __first2 = __x.begin();
  iterator __last2 = __x.end();
  while (__first1 != __last1 && __first2 != __last2)
    if (__comp(*__first2, *__first1)) {
      iterator __next = __first2;
      transfer(__first1, __first2, ++__next);
      __first2 = __next;
    }
    else
      ++__first1;
  if (__first2 != __last2) transfer(__last1, __first2, __last2);
}

template <class _Tp, class _Alloc> template <class _StrictWeakOrdering>
void list<_Tp, _Alloc>::sort(_StrictWeakOrdering __comp)
{
   
  if (_M_node->_M_next != _M_node &&
      ((_Node*) (_M_node->_M_next))->_M_next != _M_node) {
    list<_Tp, _Alloc> __carry;
    list<_Tp, _Alloc> __counter[64];
    int __fill = 0;
    while (!empty()) {
      __carry.splice(__carry.begin(), *this, begin());
      int __i = 0;
      while(__i < __fill && !__counter[__i].empty()) {
        __counter[__i].merge(__carry, __comp);
        __carry.swap(__counter[__i++]);
      }
      __carry.swap(__counter[__i]);         
      if (__i == __fill) ++__fill;
    } 

    for (int __i = 1; __i < __fill; ++__i) 
      __counter[__i].merge(__counter[__i-1], __comp);
    swap(__counter[__fill-1]);
  }
}








  



 
 
 
# 34 "/usr/include/g++-3/list" 2 3




 
 
 
# 11 "object.h" 2

# 1 "/usr/include/g++-3/string" 1 3
 




# 1 "/usr/include/g++-3/std/bastring.h" 1 3
 
 

 
 
 
 
 

 
 
 
 

 
 
 

 
 
 
 
 

 
 





#pragma interface


# 1 "/usr/include/g++-3/cstddef" 1 3
 
 



# 1 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 1 3
# 345 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3

# 6 "/usr/include/g++-3/cstddef" 2 3


# 35 "/usr/include/g++-3/std/bastring.h" 2 3

# 1 "/usr/include/g++-3/std/straits.h" 1 3
 
 

 
 
 
 
 

 
 
 
 

 
 
 

 
 
 
 
 

 
 





 
#pragma interface "std/straits.h"




extern "C++" {
template <class charT>
struct string_char_traits {
  typedef charT char_type;  

   

  static void assign (char_type& c1, const char_type& c2)
    { c1 = c2; }
  static bool eq (const char_type& c1, const char_type& c2)
    { return (c1 == c2); }
  static bool ne (const char_type& c1, const char_type& c2)
    { return !(c1 == c2); }
  static bool lt (const char_type& c1, const char_type& c2)
    { return (c1 < c2); }
  static char_type eos () { return char_type(); }  
  static bool is_del(char_type a) { return 0; }
   
  
   

  static int compare (const char_type* s1, const char_type* s2, size_t n)
    {
      size_t i;
      for (i = 0; i < n; ++i)
	if (ne (s1[i], s2[i]))
	  return lt (s1[i], s2[i]) ? -1 : 1;

      return 0;
    }
    
  static size_t length (const char_type* s)
    {
      size_t l = 0;
      while (ne (*s++, eos ()))
	++l;
      return l;
    }

  static char_type* copy (char_type* s1, const char_type* s2, size_t n)
    {
      for (; n--; )
	assign (s1[n], s2[n]);
      return s1;
    }

  static char_type* move (char_type* s1, const char_type* s2, size_t n)
    {
      char_type a[n];
      size_t i;
      for (i = 0; i < n; ++i)
	assign (a[i], s2[i]);
      for (i = 0; i < n; ++i)
	assign (s1[i], a[i]);
      return s1;
    }

  static char_type* set (char_type* s1, const char_type& c, size_t n)
    {
      for (; n--; )
	assign (s1[n], c);
      return s1;
    }
};

class istream;
class ostream;
# 1 "/usr/include/g++-3/cctype" 1 3
 
 



# 1 "/usr/include/ctype.h" 1 3


extern "C" {





int __attribute__((__cdecl__))   isalnum    (int __c)  ;
int __attribute__((__cdecl__))   isalpha    (int __c)  ;
int __attribute__((__cdecl__))   iscntrl    (int __c)  ;
int __attribute__((__cdecl__))   isdigit    (int __c)  ;
int __attribute__((__cdecl__))   isgraph    (int __c)  ;
int __attribute__((__cdecl__))   islower    (int __c)  ;
int __attribute__((__cdecl__))   isprint    (int __c)  ;
int __attribute__((__cdecl__))   ispunct    (int __c)  ;
int __attribute__((__cdecl__))   isspace    (int __c)  ;
int __attribute__((__cdecl__))   isupper    (int __c)  ;
int __attribute__((__cdecl__))   isxdigit   (int __c)  ;
int __attribute__((__cdecl__))   tolower    (int __c)  ;
int __attribute__((__cdecl__))   toupper    (int __c)  ;


int __attribute__((__cdecl__))   isascii    (int __c)  ;
int __attribute__((__cdecl__))   toascii    (int __c)  ;
int __attribute__((__cdecl__))   _tolower    (int __c)  ;
int __attribute__((__cdecl__))   _toupper    (int __c)  ;











extern	__attribute__(( dllimport ))   const  char	_ctype_[];

# 61 "/usr/include/ctype.h" 3








}


# 6 "/usr/include/g++-3/cctype" 2 3


# 105 "/usr/include/g++-3/std/straits.h" 2 3

# 1 "/usr/include/g++-3/cstring" 1 3
 
 






# 94 "/usr/include/g++-3/cstring" 3



# 106 "/usr/include/g++-3/std/straits.h" 2 3


struct string_char_traits <char> {
  typedef char char_type;

  static void assign (char_type& c1, const char_type& c2)
    { c1 = c2; }
  static bool eq (const char_type & c1, const char_type& c2)
    { return (c1 == c2); }
  static bool ne (const char_type& c1, const char_type& c2)
    { return (c1 != c2); }
  static bool lt (const char_type& c1, const char_type& c2)
    { return (c1 < c2); }
  static char_type eos () { return 0; }
  static bool is_del(char_type a) { return isspace(a); }

  static int compare (const char_type* s1, const char_type* s2, size_t n)
    { return memcmp (s1, s2, n); }
  static size_t length (const char_type* s)
    { return strlen (s); }
  static char_type* copy (char_type* s1, const char_type* s2, size_t n)
    { return (char_type*) memcpy (s1, s2, n); }
  static char_type* move (char_type* s1, const char_type* s2, size_t n)
    { return (char_type*) memmove (s1, s2, n); }
  static char_type* set (char_type* s1, const char_type& c, size_t n)
    { return (char_type*) memset (s1, c, n); }
};

# 159 "/usr/include/g++-3/std/straits.h" 3

}  

# 36 "/usr/include/g++-3/std/bastring.h" 2 3


 
# 1 "/usr/include/g++-3/alloc.h" 1 3
 






















# 40 "/usr/include/g++-3/alloc.h" 3




 
 
 
# 39 "/usr/include/g++-3/std/bastring.h" 2 3


extern "C++" {
class istream; class ostream;

# 1 "/usr/include/g++-3/iterator" 1 3
 






























# 1 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 1 3
# 345 "/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/include/stddef.h" 3

# 32 "/usr/include/g++-3/iterator" 2 3










 
 
 
# 44 "/usr/include/g++-3/std/bastring.h" 2 3




extern void __out_of_range (const char *);
extern void __length_error (const char *);














template <class charT, class traits = string_char_traits<charT>,
	  class Allocator = alloc >
class basic_string
{
private:
  struct Rep {
    size_t len, res, ref;
    bool selfish;

    charT* data () { return reinterpret_cast<charT *>(this + 1); }
    charT& operator[] (size_t s) { return data () [s]; }
    charT* grab () { if (selfish) return clone (); ++ref; return data (); }

    void release ()
      {
	size_t __val;
	 
	 
	 
	 
	asm (".byte 0xf0, 0x0f, 0xc1, 0x02"  
	    : "=a" (__val)
	    : "0" (-1), "m" (ref), "d" (&ref)
	    : "memory");

	if (__val == 1)
	  delete this;
      }
# 110 "/usr/include/g++-3/std/bastring.h" 3


    inline static void * operator new (size_t, size_t);
    inline static void operator delete (void *);
    inline static Rep* create (size_t);
    charT* clone ();

    inline void copy (size_t, const charT *, size_t);
    inline void move (size_t, const charT *, size_t);
    inline void set  (size_t, const charT,   size_t);

    inline static bool excess_slop (size_t, size_t);
    inline static size_t frob_size (size_t);

  private:
    Rep &operator= (const Rep &);
  };

public:
 
  typedef	   traits		traits_type;
  typedef typename traits::char_type	value_type;
  typedef	   Allocator		allocator_type;

  typedef size_t size_type;
  typedef ptrdiff_t difference_type;
  typedef charT& reference;
  typedef const charT& const_reference;
  typedef charT* pointer;
  typedef const charT* const_pointer;
  typedef pointer iterator;
  typedef const_pointer const_iterator;
  typedef ::reverse_iterator<iterator> reverse_iterator;
  typedef ::reverse_iterator<const_iterator> const_reverse_iterator;
  static const size_type npos = static_cast<size_type>(-1);

private:
  Rep *rep () const { return reinterpret_cast<Rep *>(dat) - 1; }
  void repup (Rep *p) { rep ()->release (); dat = p->data (); }

public:
  const charT* data () const
    { return rep ()->data(); }
  size_type length () const
    { return rep ()->len; }
  size_type size () const
    { return rep ()->len; }
  size_type capacity () const
    { return rep ()->res; }
  size_type max_size () const
    { return (npos - 1)/sizeof (charT); }		 
  bool empty () const
    { return size () == 0; }

 
  basic_string& operator= (const basic_string& str)
    {
      if (&str != this) { rep ()->release (); dat = str.rep ()->grab (); }
      return *this;
    }

  explicit basic_string (): dat (nilRep.grab ()) { }
  basic_string (const basic_string& str): dat (str.rep ()->grab ()) { }
  basic_string (const basic_string& str, size_type pos, size_type n = npos)
    : dat (nilRep.grab ()) { assign (str, pos, n); }
  basic_string (const charT* s, size_type n)
    : dat (nilRep.grab ()) { assign (s, n); }
  basic_string (const charT* s)
    : dat (nilRep.grab ()) { assign (s); }
  basic_string (size_type n, charT c)
    : dat (nilRep.grab ()) { assign (n, c); }

  template<class InputIterator>
    basic_string(InputIterator __begin, InputIterator __end)



    : dat (nilRep.grab ()) { assign (__begin, __end); }

  ~basic_string ()
    { rep ()->release (); }

  void swap (basic_string &s) { charT *d = dat; dat = s.dat; s.dat = d; }

  basic_string& append (const basic_string& str, size_type pos = 0,
			size_type n = npos)
    { return replace (length (), 0, str, pos, n); }
  basic_string& append (const charT* s, size_type n)
    { return replace (length (), 0, s, n); }
  basic_string& append (const charT* s)
    { return append (s, traits::length (s)); }
  basic_string& append (size_type n, charT c)
    { return replace (length (), 0, n, c); }

  template<class InputIterator>
    basic_string& append(InputIterator first, InputIterator last)



    { return replace (iend (), iend (), first, last); }

  void push_back(charT __c)
  { append(1, __c); }
  
  basic_string& assign (const basic_string& str, size_type pos = 0,
			size_type n = npos)
    { return replace (0, npos, str, pos, n); }
  basic_string& assign (const charT* s, size_type n)
    { return replace (0, npos, s, n); }
  basic_string& assign (const charT* s)
    { return assign (s, traits::length (s)); }
  basic_string& assign (size_type n, charT c)
    { return replace (0, npos, n, c); }

  template<class InputIterator>
    basic_string& assign(InputIterator first, InputIterator last)



    { return replace (ibegin (), iend (), first, last); }

  basic_string& operator= (const charT* s)
    { return assign (s); }
  basic_string& operator= (charT c)
    { return assign (1, c); }

  basic_string& operator+= (const basic_string& rhs)
    { return append (rhs); }
  basic_string& operator+= (const charT* s)
    { return append (s); }
  basic_string& operator+= (charT c)
    { return append (1, c); }

  basic_string& insert (size_type pos1, const basic_string& str,
			size_type pos2 = 0, size_type n = npos)
    { return replace (pos1, 0, str, pos2, n); }
  basic_string& insert (size_type pos, const charT* s, size_type n)
    { return replace (pos, 0, s, n); }
  basic_string& insert (size_type pos, const charT* s)
    { return insert (pos, s, traits::length (s)); }
  basic_string& insert (size_type pos, size_type n, charT c)
    { return replace (pos, 0, n, c); }
  iterator insert(iterator p, charT c)
    { size_type __o = p - ibegin ();
      insert (p - ibegin (), 1, c); selfish ();
      return ibegin () + __o; }
  iterator insert(iterator p, size_type n, charT c)
    { size_type __o = p - ibegin ();
      insert (p - ibegin (), n, c); selfish ();
      return ibegin () + __o; }

  template<class InputIterator>
    void insert(iterator p, InputIterator first, InputIterator last)



    { replace (p, p, first, last); }

  basic_string& erase (size_type pos = 0, size_type n = npos)
    { return replace (pos, n, (size_type)0, (charT)0); }
  iterator erase(iterator p)
    { size_type __o = p - begin();
      replace (__o, 1, (size_type)0, (charT)0); selfish ();
      return ibegin() + __o; }
  iterator erase(iterator f, iterator l)
    { size_type __o = f - ibegin();
      replace (__o, l-f, (size_type)0, (charT)0);selfish ();
      return ibegin() + __o; }

  basic_string& replace (size_type pos1, size_type n1, const basic_string& str,
			 size_type pos2 = 0, size_type n2 = npos);
  basic_string& replace (size_type pos, size_type n1, const charT* s,
			 size_type n2);
  basic_string& replace (size_type pos, size_type n1, const charT* s)
    { return replace (pos, n1, s, traits::length (s)); }
  basic_string& replace (size_type pos, size_type n1, size_type n2, charT c);
  basic_string& replace (size_type pos, size_type n, charT c)
    { return replace (pos, n, 1, c); }
  basic_string& replace (iterator i1, iterator i2, const basic_string& str)
    { return replace (i1 - ibegin (), i2 - i1, str); }
  basic_string& replace (iterator i1, iterator i2, const charT* s, size_type n)
    { return replace (i1 - ibegin (), i2 - i1, s, n); }
  basic_string& replace (iterator i1, iterator i2, const charT* s)
    { return replace (i1 - ibegin (), i2 - i1, s); }
  basic_string& replace (iterator i1, iterator i2, size_type n, charT c)
    { return replace (i1 - ibegin (), i2 - i1, n, c); }

  template<class InputIterator>
    basic_string& replace(iterator i1, iterator i2,
			  InputIterator j1, InputIterator j2);





private:
  static charT eos () { return traits::eos (); }
  void unique () { if (rep ()->ref > 1) alloc (length (), true); }
  void selfish () { unique (); rep ()->selfish = true; }

public:
  charT operator[] (size_type pos) const
    {
      if (pos == length ())
	return eos ();
      return data ()[pos];
    }

  reference operator[] (size_type pos)
    { selfish (); return (*rep ())[pos]; }

  reference at (size_type pos)
    {
      do { if ( pos >= length () ) __out_of_range ("pos >= length ()"); } while (0) ;
      return (*this)[pos];
    }
  const_reference at (size_type pos) const
    {
      do { if ( pos >= length () ) __out_of_range ("pos >= length ()"); } while (0) ;
      return data ()[pos];
    }

private:
  void terminate () const
    { traits::assign ((*rep ())[length ()], eos ()); }

public:
  const charT* c_str () const
    { if (length () == 0) return ""; terminate (); return data (); }
  void resize (size_type n, charT c);
  void resize (size_type n)
    { resize (n, eos ()); }
  void reserve (size_type) { }

  size_type copy (charT* s, size_type n, size_type pos = 0) const;

  size_type find (const basic_string& str, size_type pos = 0) const
    { return find (str.data(), pos, str.length()); }
  size_type find (const charT* s, size_type pos, size_type n) const;
  size_type find (const charT* s, size_type pos = 0) const
    { return find (s, pos, traits::length (s)); }
  size_type find (charT c, size_type pos = 0) const;

  size_type rfind (const basic_string& str, size_type pos = npos) const
    { return rfind (str.data(), pos, str.length()); }
  size_type rfind (const charT* s, size_type pos, size_type n) const;
  size_type rfind (const charT* s, size_type pos = npos) const
    { return rfind (s, pos, traits::length (s)); }
  size_type rfind (charT c, size_type pos = npos) const;

  size_type find_first_of (const basic_string& str, size_type pos = 0) const
    { return find_first_of (str.data(), pos, str.length()); }
  size_type find_first_of (const charT* s, size_type pos, size_type n) const;
  size_type find_first_of (const charT* s, size_type pos = 0) const
    { return find_first_of (s, pos, traits::length (s)); }
  size_type find_first_of (charT c, size_type pos = 0) const
    { return find (c, pos); }

  size_type find_last_of (const basic_string& str, size_type pos = npos) const
    { return find_last_of (str.data(), pos, str.length()); }
  size_type find_last_of (const charT* s, size_type pos, size_type n) const;
  size_type find_last_of (const charT* s, size_type pos = npos) const
    { return find_last_of (s, pos, traits::length (s)); }
  size_type find_last_of (charT c, size_type pos = npos) const
    { return rfind (c, pos); }

  size_type find_first_not_of (const basic_string& str, size_type pos = 0) const
    { return find_first_not_of (str.data(), pos, str.length()); }
  size_type find_first_not_of (const charT* s, size_type pos, size_type n) const;
  size_type find_first_not_of (const charT* s, size_type pos = 0) const
    { return find_first_not_of (s, pos, traits::length (s)); }
  size_type find_first_not_of (charT c, size_type pos = 0) const;

  size_type find_last_not_of (const basic_string& str, size_type pos = npos) const
    { return find_last_not_of (str.data(), pos, str.length()); }
  size_type find_last_not_of (const charT* s, size_type pos, size_type n) const;
  size_type find_last_not_of (const charT* s, size_type pos = npos) const
    { return find_last_not_of (s, pos, traits::length (s)); }
  size_type find_last_not_of (charT c, size_type pos = npos) const;

  basic_string substr (size_type pos = 0, size_type n = npos) const
    { return basic_string (*this, pos, n); }

  int compare (const basic_string& str, size_type pos = 0, size_type n = npos) const;
   
  int compare (const charT* s, size_type pos, size_type n) const;
  int compare (const charT* s, size_type pos = 0) const
    { return compare (s, pos, traits::length (s)); }

  iterator begin () { selfish (); return &(*this)[0]; }
  iterator end () { selfish (); return &(*this)[length ()]; }

private:
  iterator ibegin () const { return &(*rep ())[0]; }
  iterator iend () const { return &(*rep ())[length ()]; }

public:
  const_iterator begin () const { return ibegin (); }
  const_iterator end () const { return iend (); }

  reverse_iterator       rbegin() { return reverse_iterator (end ()); }
  const_reverse_iterator rbegin() const
    { return const_reverse_iterator (end ()); }
  reverse_iterator       rend() { return reverse_iterator (begin ()); }
  const_reverse_iterator rend() const
    { return const_reverse_iterator (begin ()); }

private:
  void alloc (size_type size, bool save);
  static size_type _find (const charT* ptr, charT c, size_type xpos, size_type len);
  inline bool check_realloc (size_type s) const;

  static Rep nilRep;
  charT *dat;
};


template <class charT, class traits, class Allocator> template <class InputIterator>
basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>::
replace (iterator i1, iterator i2, InputIterator j1, InputIterator j2)





{
  const size_type len = length ();
  size_type pos = i1 - ibegin ();
  size_type n1 = i2 - i1;
  size_type n2 = j2 - j1;

  do { if ( pos > len ) __out_of_range ("pos > len"); } while (0) ;
  if (n1 > len - pos)
    n1 = len - pos;
  do { if ( len - n1 > max_size () - n2 ) __length_error ("len - n1 > max_size () - n2"); } while (0) ;
  size_t newlen = len - n1 + n2;

  if (check_realloc (newlen))
    {
      Rep *p = Rep::create (newlen);
      p->copy (0, data (), pos);
      p->copy (pos + n2, data () + pos + n1, len - (pos + n1));
      for (; j1 != j2; ++j1, ++pos)
	traits::assign ((*p)[pos], *j1);
      repup (p);
    }
  else
    {
      rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1));
      for (; j1 != j2; ++j1, ++pos)
	traits::assign ((*rep ())[pos], *j1);
    }
  rep ()->len = newlen;

  return *this;
}

template <class charT, class traits, class Allocator>
inline basic_string <charT, traits, Allocator>
operator+ (const basic_string <charT, traits, Allocator>& lhs,
	   const basic_string <charT, traits, Allocator>& rhs)
{
  basic_string <charT, traits, Allocator> str (lhs);
  str.append (rhs);
  return str;
}

template <class charT, class traits, class Allocator>
inline basic_string <charT, traits, Allocator>
operator+ (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
  basic_string <charT, traits, Allocator> str (lhs);
  str.append (rhs);
  return str;
}

template <class charT, class traits, class Allocator>
inline basic_string <charT, traits, Allocator>
operator+ (charT lhs, const basic_string <charT, traits, Allocator>& rhs)
{
  basic_string <charT, traits, Allocator> str (1, lhs);
  str.append (rhs);
  return str;
}

template <class charT, class traits, class Allocator>
inline basic_string <charT, traits, Allocator>
operator+ (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
  basic_string <charT, traits, Allocator> str (lhs);
  str.append (rhs);
  return str;
}

template <class charT, class traits, class Allocator>
inline basic_string <charT, traits, Allocator>
operator+ (const basic_string <charT, traits, Allocator>& lhs, charT rhs)
{
  basic_string <charT, traits, Allocator> str (lhs);
  str.append (1, rhs);
  return str;
}

template <class charT, class traits, class Allocator>
inline bool
operator== (const basic_string <charT, traits, Allocator>& lhs,
	    const basic_string <charT, traits, Allocator>& rhs)
{
  return (lhs.compare (rhs) == 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator== (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
  return (rhs.compare (lhs) == 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator== (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
  return (lhs.compare (rhs) == 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator!= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
  return (rhs.compare (lhs) != 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator!= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
  return (lhs.compare (rhs) != 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator< (const basic_string <charT, traits, Allocator>& lhs,
	    const basic_string <charT, traits, Allocator>& rhs)
{
  return (lhs.compare (rhs) < 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator< (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
  return (rhs.compare (lhs) > 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator< (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
  return (lhs.compare (rhs) < 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator> (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
  return (rhs.compare (lhs) < 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator> (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
  return (lhs.compare (rhs) > 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator<= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
  return (rhs.compare (lhs) >= 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator<= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
  return (lhs.compare (rhs) <= 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator>= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
  return (rhs.compare (lhs) <= 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator>= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
  return (lhs.compare (rhs) >= 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator!= (const basic_string <charT, traits, Allocator>& lhs,
	    const basic_string <charT, traits, Allocator>& rhs)
{
  return (lhs.compare (rhs) != 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator> (const basic_string <charT, traits, Allocator>& lhs,
	   const basic_string <charT, traits, Allocator>& rhs)
{
  return (lhs.compare (rhs) > 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator<= (const basic_string <charT, traits, Allocator>& lhs,
	    const basic_string <charT, traits, Allocator>& rhs)
{
  return (lhs.compare (rhs) <= 0);
}

template <class charT, class traits, class Allocator>
inline bool
operator>= (const basic_string <charT, traits, Allocator>& lhs,
	    const basic_string <charT, traits, Allocator>& rhs)
{
  return (lhs.compare (rhs) >= 0);
}

class istream; class ostream;
template <class charT, class traits, class Allocator> istream&
operator>> (istream&, basic_string <charT, traits, Allocator>&);
template <class charT, class traits, class Allocator> ostream&
operator<< (ostream&, const basic_string <charT, traits, Allocator>&);
template <class charT, class traits, class Allocator> istream&
getline (istream&, basic_string <charT, traits, Allocator>&, charT delim = '\n');

}  

# 1 "/usr/include/g++-3/std/bastring.cc" 1 3
 
 

 
 
 
 
 

 
 
 
 

 
 
 

 
 
 
 
 

 
 

extern "C++" {
template <class charT, class traits, class Allocator>
inline void * basic_string <charT, traits, Allocator>::Rep::
operator new (size_t s, size_t extra)
{
  return Allocator::allocate(s + extra * sizeof (charT));
}

template <class charT, class traits, class Allocator>
inline void basic_string <charT, traits, Allocator>::Rep::
operator delete (void * ptr)
{
  Allocator::deallocate(ptr, sizeof(Rep) +
			reinterpret_cast<Rep *>(ptr)->res *
			sizeof (charT));
}

template <class charT, class traits, class Allocator>
inline size_t basic_string <charT, traits, Allocator>::Rep::
frob_size (size_t s)
{
  size_t i = 16;
  while (i < s) i *= 2;
  return i;
}

template <class charT, class traits, class Allocator>
inline basic_string <charT, traits, Allocator>::Rep *
basic_string <charT, traits, Allocator>::Rep::
create (size_t extra)
{
  extra = frob_size (extra + 1);
  Rep *p = new (extra) Rep;
  p->res = extra;
  p->ref = 1;
  p->selfish = false;
  return p;
}

template <class charT, class traits, class Allocator>
charT * basic_string <charT, traits, Allocator>::Rep::
clone ()
{
  Rep *p = Rep::create (len);
  p->copy (0, data (), len);
  p->len = len;
  return p->data ();
}

template <class charT, class traits, class Allocator>
inline bool basic_string <charT, traits, Allocator>::Rep::
excess_slop (size_t s, size_t r)
{
  return 2 * (s <= 16 ? 16 : s) < r;
}

template <class charT, class traits, class Allocator>
inline bool basic_string <charT, traits, Allocator>::
check_realloc (basic_string::size_type s) const
{
  s += sizeof (charT);
  rep ()->selfish = false;
  return (rep ()->ref > 1
	  || s > capacity ()
	  || Rep::excess_slop (s, capacity ()));
}

template <class charT, class traits, class Allocator>
void basic_string <charT, traits, Allocator>::
alloc (basic_string::size_type __size, bool __save)
{
  if (! check_realloc (__size))
    return;

  Rep *p = Rep::create (__size);

  if (__save)
    {
      p->copy (0, data (), length ());
      p->len = length ();
    }
  else
    p->len = 0;

  repup (p);
}

template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>&
basic_string <charT, traits, Allocator>::
replace (size_type pos1, size_type n1,
	 const basic_string& str, size_type pos2, size_type n2)
{
  const size_t len2 = str.length ();

  if (pos1 == 0 && n1 >= length () && pos2 == 0 && n2 >= len2)
    return operator= (str);

  do { if ( pos2 > len2 ) __out_of_range ("pos2 > len2"); } while (0) ;

  if (n2 > len2 - pos2)
    n2 = len2 - pos2;

  return replace (pos1, n1, str.data () + pos2, n2);
}

template <class charT, class traits, class Allocator>
inline void basic_string <charT, traits, Allocator>::Rep::
copy (size_t pos, const charT *s, size_t n)
{
  if (n)
    traits::copy (data () + pos, s, n);
}

template <class charT, class traits, class Allocator>
inline void basic_string <charT, traits, Allocator>::Rep::
move (size_t pos, const charT *s, size_t n)
{
  if (n)
    traits::move (data () + pos, s, n);
}

template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>&
basic_string <charT, traits, Allocator>::
replace (size_type pos, size_type n1, const charT* s, size_type n2)
{
  const size_type len = length ();
  do { if ( pos > len ) __out_of_range ("pos > len"); } while (0) ;
  if (n1 > len - pos)
    n1 = len - pos;
  do { if ( len - n1 > max_size () - n2 ) __length_error ("len - n1 > max_size () - n2"); } while (0) ;
  size_t newlen = len - n1 + n2;

  if (check_realloc (newlen))
    {
      Rep *p = Rep::create (newlen);
      p->copy (0, data (), pos);
      p->copy (pos + n2, data () + pos + n1, len - (pos + n1));
      p->copy (pos, s, n2);
      repup (p);
    }
  else
    {
      rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1));
      rep ()->copy (pos, s, n2);
    }
  rep ()->len = newlen;

  return *this;
}

template <class charT, class traits, class Allocator>
inline void basic_string <charT, traits, Allocator>::Rep::
set (size_t pos, const charT c, size_t n)
{
  traits::set  (data () + pos, c, n);
}

template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>::
replace (size_type pos, size_type n1, size_type n2, charT c)
{
  const size_t len = length ();
  do { if ( pos > len ) __out_of_range ("pos > len"); } while (0) ;
  if (n1 > len - pos)
    n1 = len - pos;
  do { if ( len - n1 > max_size () - n2 ) __length_error ("len - n1 > max_size () - n2"); } while (0) ;
  size_t newlen = len - n1 + n2;

  if (check_realloc (newlen))
    {
      Rep *p = Rep::create (newlen);
      p->copy (0, data (), pos);
      p->copy (pos + n2, data () + pos + n1, len - (pos + n1));
      p->set  (pos, c, n2);
      repup (p);
    }
  else
    {
      rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1));
      rep ()->set  (pos, c, n2);
    }
  rep ()->len = newlen;

  return *this;
}

template <class charT, class traits, class Allocator>
void basic_string <charT, traits, Allocator>::
resize (size_type n, charT c)
{
  do { if ( n > max_size () ) __length_error ("n > max_size ()"); } while (0) ;

  if (n > length ())
    append (n - length (), c);
  else
    erase (n);
}

template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
copy (charT* s, size_type n, size_type pos) const
{
  do { if ( pos > length () ) __out_of_range ("pos > length ()"); } while (0) ;

  if (n > length () - pos)
    n = length () - pos;

  traits::copy (s, data () + pos, n);
  return n;
}

template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find (const charT* s, size_type pos, size_type n) const
{
  size_t xpos = pos;
  for (; xpos + n <= length (); ++xpos)
    if (traits::eq (data () [xpos], *s)
	&& traits::compare (data () + xpos, s, n) == 0)
      return xpos;
  return npos;
}

template <class charT, class traits, class Allocator>
inline basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
_find (const charT* ptr, charT c, size_type xpos, size_type len)
{
  for (; xpos < len; ++xpos)
    if (traits::eq (ptr [xpos], c))
      return xpos;
  return npos;
}

template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find (charT c, size_type pos) const
{
  return _find (data (), c, pos, length ());
}

template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
rfind (const charT* s, size_type pos, size_type n) const
{
  if (n > length ())
    return npos;

  size_t xpos = length () - n;
  if (xpos > pos)
    xpos = pos;

  for (++xpos; xpos-- > 0; )
    if (traits::eq (data () [xpos], *s)
	&& traits::compare (data () + xpos, s, n) == 0)
      return xpos;
  return npos;
}

template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
rfind (charT c, size_type pos) const
{
  if (1 > length ())
    return npos;

  size_t xpos = length () - 1;
  if (xpos > pos)
    xpos = pos;

  for (++xpos; xpos-- > 0; )
    if (traits::eq (data () [xpos], c))
      return xpos;
  return npos;
}

template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find_first_of (const charT* s, size_type pos, size_type n) const
{
  size_t xpos = pos;
  for (; xpos < length (); ++xpos)
    if (_find (s, data () [xpos], 0, n) != npos)
      return xpos;
  return npos;
}

template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find_last_of (const charT* s, size_type pos, size_type n) const
{
  if (length() == 0)
    return npos;
  size_t xpos = length () - 1;
  if (xpos > pos)
    xpos = pos;
  for (++xpos; xpos-- > 0;)
    if (_find (s, data () [xpos], 0, n) != npos)
      return xpos;
  return npos;
}

template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find_first_not_of (const charT* s, size_type pos, size_type n) const
{
  size_t xpos = pos;
  for (; xpos < length (); ++xpos)
    if (_find (s, data () [xpos], 0, n) == npos)
      return xpos;
  return npos;
}

template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find_first_not_of (charT c, size_type pos) const
{
  size_t xpos = pos;
  for (; xpos < length (); ++xpos)
    if (traits::ne (data () [xpos], c))
      return xpos;
  return npos;
}

template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find_last_not_of (const charT* s, size_type pos, size_type n) const
{
  if (length() == 0)
    return npos;
  size_t xpos = length () - 1;
  if (xpos > pos)
    xpos = pos;
  for (++xpos; xpos-- > 0;)
    if (_find (s, data () [xpos], 0, n) == npos)
      return xpos;
  return npos;
}

template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find_last_not_of (charT c, size_type pos) const
{
  if (length() == 0)
    return npos;
  size_t xpos = length () - 1;
  if (xpos > pos)
    xpos = pos;
  for (++xpos; xpos-- > 0;)
    if (traits::ne (data () [xpos], c))
      return xpos;
  return npos;
}

template <class charT, class traits, class Allocator>
int basic_string <charT, traits, Allocator>::
compare (const basic_string& str, size_type pos, size_type n) const
{
  do { if ( pos > length () ) __out_of_range ("pos > length ()"); } while (0) ;

  size_t rlen = length () - pos;
  if (rlen > n)
    rlen = n;
  if (rlen > str.length ())
    rlen = str.length ();
  int r = traits::compare (data () + pos, str.data (), rlen);
  if (r != 0)
    return r;
  if (rlen == n)
    return 0;
  return (length () - pos) - str.length ();
}

template <class charT, class traits, class Allocator>
int basic_string <charT, traits, Allocator>::
compare (const charT* s, size_type pos, size_type n) const
{
  do { if ( pos > length () ) __out_of_range ("pos > length ()"); } while (0) ;

  size_t rlen = length () - pos;
  if (rlen > n)
    rlen = n;
  int r = traits::compare (data () + pos, s, rlen);
  if (r != 0)
    return r;
  return (length () - pos) - n;
}



template <class charT, class traits, class Allocator>
istream &
operator>> (istream &is, basic_string <charT, traits, Allocator> &s)
{
  int w = is.width (0);
  if (is.ipfx0 ())
    {
      register streambuf *sb = is.rdbuf ();
      s.resize (0);
      while (1)
	{
	  int ch = sb->sbumpc ();
	  if (ch == (-1) )
	    {
	      is.setstate (ios::eofbit);
	      break;
	    }
	  else if (traits::is_del (ch))
	    {
	      sb->sungetc ();
	      break;
	    }
	  s += static_cast<charT> (ch);
	  if (--w == 1)
	    break;
	}
    }

  is.isfx ();
  if (s.length () == 0)
    is.setstate (ios::failbit);

  return is;
}

template <class charT, class traits, class Allocator>
ostream &
operator<< (ostream &o, const basic_string <charT, traits, Allocator>& s)
{
  return o.write (s.data (), s.length ());
}

template <class charT, class traits, class Allocator>
istream&
getline (istream &is, basic_string <charT, traits, Allocator>& s, charT delim)
{
  if (is.ipfx1 ())
    {
      _G_size_t  count = 0;
      streambuf *sb = is.rdbuf ();
      s.resize (0);

      while (1)
	{
	  int ch = sb->sbumpc ();
	  if (ch == (-1) )
	    {
	      is.setstate (count == 0
			   ? (ios::failbit|ios::eofbit)
			   : ios::eofbit);
	      break;
	    }

	  ++count;

	  if (ch == delim)
	    break;

	  s += static_cast<charT> (ch);

	  if (s.length () == s.npos - 1)
	    {
	      is.setstate (ios::failbit);
	      break;
	    }
	}
    }

   
   
  is.isfx ();

  return is;
}

template <class charT, class traits, class Allocator>
basic_string <charT, traits, Allocator>::Rep
basic_string<charT, traits, Allocator>::nilRep = { 0, 0, 1, false };

template <class charT, class traits, class Allocator>
const basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::npos;

}  
# 655 "/usr/include/g++-3/std/bastring.h" 2 3



# 6 "/usr/include/g++-3/string" 2 3


extern "C++" {
typedef basic_string <char> string;
 
}  


# 12 "object.h" 2


# 1 "issue.h" 1
 











namespace fishtank
{

struct Issue;


struct Issue
{
	string description;
public:
	struct null_parameter;

	Issue(string desc="Unknown issue"):description(desc)
	{
		cerr<<"Issue thrown : "<<desc<<endl;
	}

	operator string(void)const
	{
		return description;
	}

};

namespace issue
{

struct null_parameter : Issue
{
	null_parameter(string desc="Unknown details"):Issue(string("NULL Parameter : ")+desc) {}
};
};  

};  



# 14 "object.h" 2





namespace fishtank
{

class World;

namespace object
{

class Base
{
public:

	World *world;

	virtual bool SetWorld(World *x) throw(Issue)
	{
		if(!x)
			throw Issue("Object::SetWorld() - NULL Parameter");
		world=x;
		return true;
	}

	virtual void operator()(void) throw(Issue)
	{
		cerr<<"process"<<endl;
	}
};

};  
};  



# 14 "main.cpp" 2

# 1 "world.h" 1
 














# 1 "camera.h" 1
 















# 1 "tangible.h" 1
 


















namespace fishtank
{

class World;

namespace object
{

class Tangible : public Base
{
public:

	Point	pos;
	Vector	vel;
	Vector	acel;

	CoordSys coordsys;

};

};  

};  



# 17 "camera.h" 2


namespace fishtank
{

namespace object
{

class Camera : public Tangible
{
public:

	const Matrix GenScrnCrdSys(void);
};

};  
};  



# 16 "world.h" 2

# 1 "handle.h" 1
 








template <class T>
class handle
{
	T *obj;
	int *refcount;
public:
	handle():obj(__null ),refcount(__null ) {}

	handle(T *x)
	{
		obj=x;
		refcount=new int(1);
	}

	template <class U>
	handle(const handle<U> &x)
	{
		obj=x.obj;
		refcount=x.refcount;
		(*refcount)++;
	}

	~handle()
	{
		(*refcount)--;
		if(!*refcount)
			delete obj;
	}

	template <class U>
	const handle<T> &operator=(const handle<U> &x)
	{
		if(obj)
		{
			(*refcount)--;
			if(!*refcount)
				delete obj;
		}
		obj=x.obj;
		refcount=x.refcount;
		(*refcount)++;
	}

	void release(void)
	{
		(*refcount)--;
		if(!*refcount)
			delete obj;
		obj= __null ;
		refcount= __null ;
	}

	T &operator*(void)
	{
		return *obj;
	}
	T &operator*(void)const
	{
		return *obj;
	}

	T *operator->() const
	{
		return &(operator*());
	}

	template <class U>
	operator U*(void)
	{
		return (U*)obj;
	}

	bool operator!()const
	{
		return !obj;
	}

	 
	template <class U> friend handle<U>;
};



# 17 "world.h" 2


namespace fishtank
{

struct World : public list<handle<object::Base> >
{
	CoordSys screen;
	CoordSys world;
	int framecount;

	handle<object::Camera> camera;

	World():world(&screen),framecount(0),camera(__null )
	{
		world=Matrix::ident();
		screen=Matrix::ident();
	}

	template <class U>	 
	bool SetCamera(U x) throw(Issue)
	{
		if(!x)
			throw issue::null_parameter("World::SetCamera() (Bad dynamic cast?)");
		camera=x;
		cerr<<"SetCamera(): Camera set"<<endl;
		return true;
	}

	const bool process(int cycles=1);

	const bool operator+=(object::Base *rhs)
	{
		push_front(rhs);
		if(!front()->SetWorld(this))
		{
			erase(begin());
			return false;
		}
		return true;
	}

	template <class U>
	const bool operator+=(const handle<U> &rhs)
	{
		push_front(rhs);
		if(!front()->SetWorld(this))
		{
			erase(begin());
			return false;
		}
		return true;
	}
};

};  



# 15 "main.cpp" 2


# 1 "fish.h" 1
 
















namespace fishtank {
namespace object {

class World;

class Fish : public Tangible
{
public:


};

};  
};  



# 17 "main.cpp" 2


using namespace std;
using namespace fishtank;

int main(void)
{
	World world;

	handle<object::Camera> mycamera=new object::Camera();
	handle<object::Base> myfish=new object::Fish();

	world+=mycamera;
	world+=myfish;

	world.process();
	world.SetCamera(mycamera);
	 
 






















	return 0;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]