From mboxrd@z Thu Jan 1 00:00:00 1970 From: Max Lawson To: egcs@cygnus.com Subject: Re: 970929 snapshot: a ghost in g++ !-) Date: Sat, 04 Oct 1997 09:44:00 -0000 Message-id: <9710041643.AA29094@drfmc.ceng.cea.fr> X-SW-Source: 1997-10/msg00187.html ---------- X-Sun-Data-Type: text X-Sun-Data-Description: text X-Sun-Data-Name: text X-Sun-Charset: us-ascii X-Sun-Content-Lines: 66 Hi ! Hope this thread is not to boring. But I can't succeed getting rid of the problem I have with "string" and "vector". Depending on the order I use to include the header file the followingtest program won't compile: > #include > #include > #include > > int main() > { > string s("a_string"); > vector v(3,-1.0); > cout << "a string: \"" << s << "\" followed by a vector element: " > << v[0] << endl; > > return 1; > } > In the order given above it *doesn't* compile giving the following error messages: > /usr/local/include/g++/stdexcept:41: syntax error before `;' > /usr/local/include/g++/stdexcept:43: parse error before `&' > /usr/local/include/g++/stdexcept:43: missing ';' before right brace > /usr/local/include/g++/stdexcept:44: extraneous `char' ignored > /usr/local/include/g++/stdexcept:44: virtual outside class declaration > /usr/local/include/g++/stdexcept:44: non-member function `what()' cannot have `const' method qualifier > /usr/local/include/g++/stdexcept: In function `const class logic_error * what()': > /usr/local/include/g++/stdexcept:44: `_what' undeclared (first use this function) > /usr/local/include/g++/stdexcept:44: (Each undeclared identifier is reported only once > /usr/local/include/g++/stdexcept:44: for each function it appears in.) > /usr/local/include/g++/stdexcept: At top level: > /usr/local/include/g++/stdexcept:49: parse error before `&' > /usr/local/include/g++/stdexcept:49: missing ';' before right brace > /usr/local/include/g++/stdexcept:54: parse error before `&' > /usr/local/include/g++/stdexcept:54: missing ';' before right brace > /usr/local/include/g++/stdexcept:59: parse error before `&' > /usr/local/include/g++/stdexcept:59: missing ';' before right brace > /usr/local/include/g++/stdexcept:64: parse error before `&' > /usr/local/include/g++/stdexcept:64: missing ';' before right brace > /usr/local/include/g++/stdexcept:68: syntax error before `;' > /usr/local/include/g++/stdexcept:70: parse error before `&' > /usr/local/include/g++/stdexcept:70: missing ';' before right brace > /usr/local/include/g++/stdexcept:71: extraneous `char' ignored > /usr/local/include/g++/stdexcept:71: virtual outside class declaration > /usr/local/include/g++/stdexcept:71: non-member function `what()' cannot have `const' method qualifier > /usr/local/include/g++/stdexcept: In function `const class runtime_error * what()': > /usr/local/include/g++/stdexcept:71: new declaration `const class runtime_error * what()' > /usr/local/include/g++/stdexcept:44: ambiguates old declaration `const class logic_error * what()' > /usr/local/include/g++/stdexcept: At top level: > /usr/local/include/g++/stdexcept:72: parse error before `protected' > /usr/local/include/g++/stdexcept:78: parse error before `&' > /usr/local/include/g++/stdexcept:78: missing ';' before right brace > /usr/local/include/g++/stdexcept:83: parse error before `&' > /usr/local/include/g++/stdexcept:83: missing ';' before right brace > /usr/local/include/g++/stdexcept:88: parse error before `&' > /usr/local/include/g++/stdexcept:88: missing ';' before right brace > Here is attached a preprocessed file using the "-E -v"options. The compilation fails with the -g flag. Thanx in advance 4 your helps. Bye, Max P.S. I upgrated to libc5.4.39 and built everything again. ---------- X-Sun-Data-Type: default X-Sun-Data-Description: default X-Sun-Data-Name: string_and_stl_vector X-Sun-Charset: us-ascii X-Sun-Content-Lines: 8025 Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/specs gcc version egcs-2.90.11 970929 (gcc2-970802 experimental) /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -g -Di386 -Di586 -Asystem(unix) -Acpu(i386) -Amachine(i386) -D__i386__ -D__i586__ -Asystem(unix) -Acpu(i386) -Amachine(i386) -D__ghost z.cc GNU CPP version egcs-2.90.11 970929 (gcc2-970802 experimental) (i386 Linux/ELF) #include "..." search starts here: #include <...> search starts here: /usr/local/include/g++ /usr/local/include /usr/local/i586-pc-linux-gnulibc1/include /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include /usr/include End of search list. # 1 "z.cc" # 1 "/usr/local/include/g++/iostream.h" 1 3 #pragma interface # 1 "/usr/local/include/g++/streambuf.h" 1 3 #pragma interface extern "C" { # 1 "/usr/local/include/g++/libio.h" 1 3 # 1 "/usr/local/i586-pc-linux-gnulibc1/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 long _G_clock_t; typedef unsigned short _G_dev_t; typedef long int _G_fpos_t; typedef unsigned short _G_gid_t; typedef unsigned long _G_ino_t; typedef unsigned short _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 long int _G_wchar_t; typedef int _G_ssize_t; typedef unsigned int _G_wint_t; typedef void * _G_va_list; # 30 "/usr/local/include/g++/libio.h" 2 3 # 51 "/usr/local/include/g++/libio.h" 3 # 1 "/usr/include/sys/cdefs.h" 1 3 # 50 "/usr/include/sys/cdefs.h" 3 # 100 "/usr/include/sys/cdefs.h" 3 typedef long double __long_double_t; # 128 "/usr/include/sys/cdefs.h" 3 # 55 "/usr/local/include/g++/libio.h" 2 3 struct _IO_jump_t; struct _IO_FILE; typedef void _IO_lock_t; struct _IO_marker { struct _IO_marker *_next; struct _IO_FILE *_sbuf; int _pos; # 182 "/usr/local/include/g++/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]; _IO_lock_t *_lock; }; 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_fpos_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_fpos_t _IO_seekoff (_IO_FILE *, _G_off_t , int, int) ; extern _G_fpos_t _IO_seekpos (_IO_FILE *, _G_fpos_t , int) ; extern void _IO_free_backup_area (_IO_FILE *) ; } # 36 "/usr/local/include/g++/streambuf.h" 2 3 } extern "C++" { class istream; class ostream; class streambuf; typedef _G_off_t streamoff; typedef _G_fpos_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; }; # 115 "/usr/local/include/g++/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 int 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 }; # 168 "/usr/local/include/g++/streambuf.h" 3 ostream* tie() const { return _tie; } ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; } short fill() const { return (short )_fill; } short fill(short newf) {short oldf = (short )_fill; _fill = (char)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 _IO_peekc_locked ( this ) ; } 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() { if (_arrays) delete [] _arrays; } } # 31 "/usr/local/include/g++/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); 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); 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 (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 (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; } } # 1 "z.cc" 2 # 1 "/usr/local/include/g++/vector" 1 3 # 1 "/usr/local/include/g++/vector.h" 1 3 # 1 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 1 3 # 61 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 typedef int ptrdiff_t; typedef unsigned int size_t; typedef unsigned int wint_t; # 302 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 30 "/usr/local/include/g++/vector.h" 2 3 # 1 "/usr/local/include/g++/algobase.h" 1 3 # 1 "/usr/include/string.h" 1 3 # 1 "/usr/include/features.h" 1 3 # 26 "/usr/include/string.h" 2 3 extern "C" { # 1 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 1 3 # 19 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 61 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 126 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 182 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 256 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 302 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 33 "/usr/include/string.h" 2 3 extern void * memmove (void * __dest, __const void * __src, size_t __n) ; extern void * __memccpy (void * __dest, __const void * __src, int __c, size_t __n) ; extern void * memccpy (void * __dest, __const void * __src, int __c, size_t __n) ; extern void * memset (void * __s, int __c, size_t __n) ; extern void * memchr (__const void * __s, int __c, size_t __n) ; extern char *strcpy (char *__dest, __const char *__src) ; extern char *strncpy (char *__dest, __const char *__src, size_t __n) ; extern char *strcat (char *__dest, __const char *__src) ; extern char *strncat (char *__dest, __const char *__src, size_t __n) ; extern int strcmp (__const char *__s1, __const char *__s2) ; extern int strncmp (__const char *__s1, __const char *__s2, size_t __n) ; extern int strcoll (__const char *__s1, __const char *__s2) ; extern size_t strxfrm (char *__dest, __const char *__src, size_t __n) ; extern char *strdup (__const char *__s) ; extern char *strchr (__const char *__s, int __c) ; extern char *strrchr (__const char *__s, int __c) ; extern size_t strcspn (__const char *__s, __const char *__reject) ; extern size_t strspn (__const char *__s, __const char *__accept) ; extern char *strpbrk (__const char *__s, __const char *__accept) ; extern char *strstr (__const char *__haystack, __const char *__needle) ; extern char *strtok (char *__s, __const char *__delim) ; extern void * memmem (__const void * __haystack, size_t __haystacklen, __const void * __needle, size_t __needlelen) ; extern size_t strlen (__const char *__s) ; extern char *strerror (int __errnum) ; extern char *index (__const char *__s, int __c) ; extern char *rindex (__const char *__s, int __c) ; # 149 "/usr/include/string.h" 3 extern void bcopy (__const void * __src, void * __dest, int __n) ; extern void bzero (void * __s, int __n) ; extern int bcmp (__const void * __s1, __const void * __s2, int __n) ; extern int ffs (int __i) ; extern int strcasecmp (__const char *__s1, __const char *__s2) ; extern char *strsep (char **__stringp, __const char *__delim) ; extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n) ; extern char *strsignal (int __sig) ; extern char *stpcpy (char *__dest, __const char *__src) ; extern char *__stpncpy (char *__dest, __const char *__src, size_t __n) ; extern char *stpncpy (char *__dest, __const char *__src, size_t __n) ; extern char *strfry (char *__string) ; extern void * memfrob (void * __s, size_t __n) ; extern void swab (__const void * __from, void * __to, size_t __nbytes) ; } # 30 "/usr/local/include/g++/algobase.h" 2 3 # 1 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/limits.h" 1 3 # 1 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/syslimits.h" 1 3 # 1 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/limits.h" 1 3 # 113 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/limits.h" 3 # 1 "/usr/include/limits.h" 1 3 # 1 "/usr/include/posix1_lim.h" 1 3 # 1 "/usr/include/linux/limits.h" 1 3 # 72 "/usr/include/posix1_lim.h" 2 3 # 30 "/usr/include/limits.h" 2 3 # 1 "/usr/include/posix2_lim.h" 1 3 # 34 "/usr/include/limits.h" 2 3 # 53 "/usr/include/limits.h" 3 # 115 "/usr/include/limits.h" 3 # 138 "/usr/include/limits.h" 3 # 116 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/limits.h" 2 3 # 7 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/syslimits.h" 2 3 # 11 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/limits.h" 2 3 # 31 "/usr/local/include/g++/algobase.h" 2 3 # 1 "/usr/local/include/g++/function.h" 1 3 # 1 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 1 3 # 327 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 30 "/usr/local/include/g++/function.h" 2 3 # 1 "/usr/local/include/g++/stl_config.h" 1 3 # 84 "/usr/local/include/g++/stl_config.h" 3 # 132 "/usr/local/include/g++/stl_config.h" 3 # 146 "/usr/local/include/g++/stl_config.h" 3 # 31 "/usr/local/include/g++/function.h" 2 3 template inline bool operator!=(const T& x, const T& y) { return !(x == y); } template inline bool operator>(const T& x, const T& y) { return y < x; } template inline bool operator<=(const T& x, const T& y) { return !(y < x); } template inline bool operator>=(const T& x, const T& y) { return !(x < y); } template struct unary_function { typedef Arg argument_type; typedef Result result_type; }; template struct binary_function { typedef Arg1 first_argument_type; typedef Arg2 second_argument_type; typedef Result result_type; }; template struct plus : public binary_function { T operator()(const T& x, const T& y) const { return x + y; } }; template struct minus : public binary_function { T operator()(const T& x, const T& y) const { return x - y; } }; template struct multiplies : public binary_function { T operator()(const T& x, const T& y) const { return x * y; } }; template struct divides : public binary_function { T operator()(const T& x, const T& y) const { return x / y; } }; template inline T identity_element(plus) { return T(0); } template inline T identity_element(multiplies) { return T(1); } template struct modulus : public binary_function { T operator()(const T& x, const T& y) const { return x % y; } }; template struct negate : public unary_function { T operator()(const T& x) const { return -x; } }; template struct equal_to : public binary_function { bool operator()(const T& x, const T& y) const { return x == y; } }; template struct not_equal_to : public binary_function { bool operator()(const T& x, const T& y) const { return x != y; } }; template struct greater : public binary_function { bool operator()(const T& x, const T& y) const { return x > y; } }; template struct less : public binary_function { bool operator()(const T& x, const T& y) const { return x < y; } }; template struct greater_equal : public binary_function { bool operator()(const T& x, const T& y) const { return x >= y; } }; template struct less_equal : public binary_function { bool operator()(const T& x, const T& y) const { return x <= y; } }; template struct logical_and : public binary_function { bool operator()(const T& x, const T& y) const { return x && y; } }; template struct logical_or : public binary_function { bool operator()(const T& x, const T& y) const { return x || y; } }; template struct logical_not : public unary_function { bool operator()(const T& x) const { return !x; } }; template class unary_negate : public unary_function { protected: Predicate pred; public: explicit unary_negate(const Predicate& x) : pred(x) {} bool operator()(const argument_type& x) const { return !pred(x); } }; template inline unary_negate not1(const Predicate& pred) { return unary_negate(pred); } template class binary_negate : public binary_function { protected: Predicate pred; public: explicit binary_negate(const Predicate& x) : pred(x) {} bool operator()(const first_argument_type& x, const second_argument_type& y) const { return !pred(x, y); } }; template inline binary_negate not2(const Predicate& pred) { return binary_negate(pred); } template class binder1st : public unary_function { protected: Operation op; typename Operation::first_argument_type value; public: binder1st(const Operation& x, const typename Operation::first_argument_type& y) : op(x), value(y) {} result_type operator()(const argument_type& x) const { return op(value, x); } }; template inline binder1st bind1st(const Operation& op, const T& x) { typedef typename Operation::first_argument_type arg1_type; return binder1st(op, arg1_type(x)); } template class binder2nd : public unary_function { protected: Operation op; typename Operation::second_argument_type value; public: binder2nd(const Operation& x, const typename Operation::second_argument_type& y) : op(x), value(y) {} result_type operator()(const argument_type& x) const { return op(x, value); } }; template inline binder2nd bind2nd(const Operation& op, const T& x) { typedef typename Operation::second_argument_type arg2_type; return binder2nd(op, arg2_type(x)); } template class unary_compose : public unary_function { protected: Operation1 op1; Operation2 op2; public: unary_compose(const Operation1& x, const Operation2& y) : op1(x), op2(y) {} result_type operator()(const argument_type& x) const { return op1(op2(x)); } }; template inline unary_compose compose1(const Operation1& op1, const Operation2& op2) { return unary_compose(op1, op2); } template class binary_compose : public unary_function { protected: Operation1 op1; Operation2 op2; Operation3 op3; public: binary_compose(const Operation1& x, const Operation2& y, const Operation3& z) : op1(x), op2(y), op3(z) { } result_type operator()(const argument_type& x) const { return op1(op2(x), op3(x)); } }; template inline binary_compose compose2(const Operation1& op1, const Operation2& op2, const Operation3& op3) { return binary_compose(op1, op2, op3); } template class pointer_to_unary_function : public unary_function { protected: Result (*ptr)(Arg); public: pointer_to_unary_function() {} explicit pointer_to_unary_function(Result (*x)(Arg)) : ptr(x) {} Result operator()(Arg x) const { return ptr(x); } }; template inline pointer_to_unary_function ptr_fun(Result (*x)(Arg)) { return pointer_to_unary_function(x); } template class pointer_to_binary_function : public binary_function { protected: Result (*ptr)(Arg1, Arg2); public: pointer_to_binary_function() {} explicit pointer_to_binary_function(Result (*x)(Arg1, Arg2)) : ptr(x) {} Result operator()(Arg1 x, Arg2 y) const { return ptr(x, y); } }; template inline pointer_to_binary_function ptr_fun(Result (*x)(Arg1, Arg2)) { return pointer_to_binary_function(x); } template struct identity : public unary_function { const T& operator()(const T& x) const { return x; } }; template struct select1st : public unary_function { const typename Pair::first_type& operator()(const Pair& x) const { return x.first; } }; template struct select2nd : public unary_function { const typename Pair::second_type& operator()(const Pair& x) const { return x.second; } }; template struct project1st : public binary_function { Arg1 operator()(const Arg1& x, const Arg2&) const { return x; } }; template struct project2nd : public binary_function { Arg2 operator()(const Arg1&, const Arg2& y) const { return y; } }; template struct constant_void_fun { typedef Result result_type; result_type val; constant_void_fun(const result_type& v) : val(v) {} const result_type& operator()() const { return val; } }; template struct constant_unary_fun : public unary_function { result_type val; constant_unary_fun(const result_type& v) : val(v) {} const result_type& operator()(const argument_type&) const { return val; } }; template struct constant_binary_fun : public binary_function { result_type val; constant_binary_fun(const result_type& v) : val(v) {} const result_type& operator()(const first_argument_type&, const second_argument_type&) const { return val; } }; template inline constant_void_fun constant0(const Result& val) { return constant_void_fun(val); } template inline constant_unary_fun constant1(const Result& val) { return constant_unary_fun(val); } template inline constant_binary_fun constant2(const Result& val) { return constant_binary_fun(val); } class subtractive_rng : public unary_function { private: unsigned int table[55]; size_t index1; size_t index2; public: unsigned int operator()(unsigned int limit) { index1 = (index1 + 1) % 55; index2 = (index2 + 1) % 55; table[index1] = table[index1] - table[index2]; return table[index1] % limit; } void initialize(unsigned int seed) { unsigned int k = 1; table[54] = seed; size_t i; for (i = 0; i < 54; i++) { size_t ii = (21 * (i + 1) % 55) - 1; table[ii] = k; k = seed - k; seed = table[ii]; } for (int loop = 0; loop < 4; loop++) { for (i = 0; i < 55; i++) table[i] = table[i] - table[(1 + i + 30) % 55]; } index1 = 0; index2 = 31; } subtractive_rng(unsigned int seed) { initialize(seed); } subtractive_rng() { initialize(161803398u); } }; template class mem_fun_t : public unary_function { public: explicit mem_fun_t(S (T::*pf)()) : f(pf) {} S operator()(T* p) const { return (p->*f)(); } private: S (T::*f)(); }; template class const_mem_fun_t : public unary_function { public: explicit const_mem_fun_t(S (T::*pf)() const) : f(pf) {} S operator()(const T* p) const { return (p->*f)(); } private: S (T::*f)() const; }; template class mem_fun_ref_t : public unary_function { public: explicit mem_fun_ref_t(S (T::*pf)()) : f(pf) {} S operator()(T& r) const { return (r.*f)(); } private: S (T::*f)(); }; template class const_mem_fun_ref_t : public unary_function { public: explicit const_mem_fun_ref_t(S (T::*pf)() const) : f(pf) {} S operator()(const T& r) const { return (r.*f)(); } private: S (T::*f)() const; }; template class mem_fun1_t : public binary_function { public: explicit mem_fun1_t(S (T::*pf)(A)) : f(pf) {} S operator()(T* p, A x) const { return (p->*f)(x); } private: S (T::*f)(A); }; template class const_mem_fun1_t : public binary_function { public: explicit const_mem_fun1_t(S (T::*pf)(A) const) : f(pf) {} S operator()(const T* p, A x) const { return (p->*f)(x); } private: S (T::*f)(A) const; }; template class mem_fun1_ref_t : public binary_function { public: explicit mem_fun1_ref_t(S (T::*pf)(A)) : f(pf) {} S operator()(T& r, A x) const { return (r.*f)(x); } private: S (T::*f)(A); }; template class const_mem_fun1_ref_t : public binary_function { public: explicit const_mem_fun1_ref_t(S (T::*pf)(A) const) : f(pf) {} S operator()(const T& r, A x) const { return (r.*f)(x); } private: S (T::*f)(A) const; }; template class mem_fun_t : public unary_function { public: explicit mem_fun_t(void (T::*pf)()) : f(pf) {} void operator()(T* p) const { (p->*f)(); } private: void (T::*f)(); }; template class const_mem_fun_t : public unary_function { public: explicit const_mem_fun_t(void (T::*pf)() const) : f(pf) {} void operator()(const T* p) const { (p->*f)(); } private: void (T::*f)() const; }; template class mem_fun_ref_t : public unary_function { public: explicit mem_fun_ref_t(void (T::*pf)()) : f(pf) {} void operator()(T& r) const { (r.*f)(); } private: void (T::*f)(); }; template class const_mem_fun_ref_t : public unary_function { public: explicit const_mem_fun_ref_t(void (T::*pf)() const) : f(pf) {} void operator()(const T& r) const { (r.*f)(); } private: void (T::*f)() const; }; template class mem_fun1_t : public binary_function { public: explicit mem_fun1_t(void (T::*pf)(A)) : f(pf) {} void operator()(T* p, A x) const { (p->*f)(x); } private: void (T::*f)(A); }; template class const_mem_fun1_t : public binary_function { public: explicit const_mem_fun1_t(void (T::*pf)(A) const) : f(pf) {} void operator()(const T* p, A x) const { (p->*f)(x); } private: void (T::*f)(A) const; }; template class mem_fun1_ref_t : public binary_function { public: explicit mem_fun1_ref_t(void (T::*pf)(A)) : f(pf) {} void operator()(T& r, A x) const { (r.*f)(x); } private: void (T::*f)(A); }; template class const_mem_fun1_ref_t : public binary_function { public: explicit const_mem_fun1_ref_t(void (T::*pf)(A) const) : f(pf) {} void operator()(const T& r, A x) const { (r.*f)(x); } private: void (T::*f)(A) const; }; template inline mem_fun_t mem_fun(S (T::*f)()) { return mem_fun_t(f); } template inline const_mem_fun_t mem_fun(S (T::*f)() const) { return const_mem_fun_t(f); } template inline mem_fun_ref_t mem_fun_ref(S (T::*f)()) { return mem_fun_ref_t(f); } template inline const_mem_fun_ref_t mem_fun_ref(S (T::*f)() const) { return const_mem_fun_ref_t(f); } template inline mem_fun1_t mem_fun1(S (T::*f)(A)) { return mem_fun1_t(f); } template inline const_mem_fun1_t mem_fun1(S (T::*f)(A) const) { return const_mem_fun1_t(f); } template inline mem_fun1_ref_t mem_fun1_ref(S (T::*f)(A)) { return mem_fun1_ref_t(f); } template inline const_mem_fun1_ref_t mem_fun1_ref(S (T::*f)(A) const) { return const_mem_fun1_ref_t(f); } # 32 "/usr/local/include/g++/algobase.h" 2 3 # 1 "/usr/local/include/g++/pair.h" 1 3 template 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 pair(const pair& p) : first(p.first), second(p.second) {} }; template inline bool operator==(const pair& x, const pair& y) { return x.first == y.first && x.second == y.second; } template inline bool operator<(const pair& x, const pair& y) { return x.first < y.first || (!(y.first < x.first) && x.second < y.second); } template inline pair make_pair(const T1& x, const T2& y) { return pair(x, y); } # 33 "/usr/local/include/g++/algobase.h" 2 3 # 1 "/usr/local/include/g++/iterator.h" 1 3 # 1 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 1 3 # 327 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 30 "/usr/local/include/g++/iterator.h" 2 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 struct input_iterator { typedef input_iterator_tag iterator_category; typedef T value_type; typedef Distance difference_type; typedef T* pointer; typedef T& 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 struct forward_iterator { typedef forward_iterator_tag iterator_category; typedef T value_type; typedef Distance difference_type; typedef T* pointer; typedef T& reference; }; template struct bidirectional_iterator { typedef bidirectional_iterator_tag iterator_category; typedef T value_type; typedef Distance difference_type; typedef T* pointer; typedef T& reference; }; template struct random_access_iterator { typedef random_access_iterator_tag iterator_category; typedef T value_type; typedef Distance difference_type; typedef T* pointer; typedef T& reference; }; # 91 "/usr/local/include/g++/iterator.h" 3 template 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 struct iterator_traits { typedef random_access_iterator_tag iterator_category; typedef T value_type; typedef ptrdiff_t difference_type; typedef T* pointer; typedef T& reference; }; template struct iterator_traits { typedef random_access_iterator_tag iterator_category; typedef T value_type; typedef ptrdiff_t difference_type; typedef const T* pointer; typedef const T& reference; }; template inline iterator_traits::iterator_category iterator_category(const Iterator&) { return iterator_traits::iterator_category(); } template inline iterator_traits::difference_type* distance_type(const Iterator&) { return static_cast::difference_type*>(0); } template inline iterator_traits::value_type* value_type(const Iterator&) { return static_cast::value_type*>(0); } # 223 "/usr/local/include/g++/iterator.h" 3 template class back_insert_iterator { protected: Container* container; public: 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& operator=(const typename Container::value_type& value) { container->push_back(value); return *this; } back_insert_iterator& operator*() { return *this; } back_insert_iterator& operator++() { return *this; } back_insert_iterator& operator++(int) { return *this; } }; # 256 "/usr/local/include/g++/iterator.h" 3 template inline back_insert_iterator back_inserter(Container& x) { return back_insert_iterator(x); } template class front_insert_iterator { protected: Container* container; public: 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& operator=(const typename Container::value_type& value) { container->push_front(value); return *this; } front_insert_iterator& operator*() { return *this; } front_insert_iterator& operator++() { return *this; } front_insert_iterator& operator++(int) { return *this; } }; # 294 "/usr/local/include/g++/iterator.h" 3 template inline front_insert_iterator front_inserter(Container& x) { return front_insert_iterator(x); } template class insert_iterator { protected: Container* container; typename Container::iterator iter; public: 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& operator=(const typename Container::value_type& value) { iter = container->insert(iter, value); ++iter; return *this; } insert_iterator& operator*() { return *this; } insert_iterator& operator++() { return *this; } insert_iterator& operator++(int) { return *this; } }; # 335 "/usr/local/include/g++/iterator.h" 3 template inline insert_iterator inserter(Container& x, Iterator i) { typedef typename Container::iterator iter; return insert_iterator(x, iter(i)); } template class reverse_bidirectional_iterator { typedef reverse_bidirectional_iterator self; friend bool operator==(const self& x, const self& y); protected: BidirectionalIterator current; public: typedef bidirectional_iterator_tag iterator_category; typedef T value_type; typedef Distance difference_type; typedef T* pointer; typedef Reference reference; reverse_bidirectional_iterator() {} explicit reverse_bidirectional_iterator(BidirectionalIterator x) : current(x) {} BidirectionalIterator base() { 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; } }; # 421 "/usr/local/include/g++/iterator.h" 3 template inline bool operator==( const reverse_bidirectional_iterator& x, const reverse_bidirectional_iterator& y) { return x.current == y.current; } template class reverse_iterator : public iterator_traits { protected: Iterator current; public: typedef Iterator iterator_type; typedef reverse_iterator self; public: reverse_iterator() {} explicit reverse_iterator(iterator_type x) : current(x) {} reverse_iterator(const self& x) : current(x.current) {} template reverse_iterator(const reverse_iterator& x) : current(x.current) {} 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) { return *(*this + n); } }; template inline bool operator==(const reverse_iterator& x, const reverse_iterator& y) { return x.base() == y.base(); } template inline bool operator<(const reverse_iterator& x, const reverse_iterator& y) { return y.base() < x.base(); } template inline reverse_iterator::difference_type operator-(const reverse_iterator& x, const reverse_iterator& y) { return y.base() - x.base(); } template inline reverse_iterator operator+(reverse_iterator::difference_type n, const reverse_iterator& x) { return reverse_iterator(x.base() - n); } # 654 "/usr/local/include/g++/iterator.h" 3 template class raw_storage_iterator { protected: ForwardIterator iter; public: typedef output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; typedef void reference; explicit raw_storage_iterator(ForwardIterator x) : iter(x) {} raw_storage_iterator& operator*() { return *this; } raw_storage_iterator& operator=(const T& element) { construct(&*iter, element); return *this; } raw_storage_iterator& operator++() { ++iter; return *this; } raw_storage_iterator operator++(int) { raw_storage_iterator tmp = *this; ++iter; return tmp; } }; # 693 "/usr/local/include/g++/iterator.h" 3 template class istream_iterator { friend bool operator==(const istream_iterator& x, const istream_iterator& y); protected: istream* stream; T value; bool end_marker; void read() { end_marker = (*stream) ? true : false; if (end_marker) *stream >> value; end_marker = (*stream) ? true : false; } public: typedef input_iterator_tag iterator_category; typedef T value_type; typedef Distance difference_type; typedef const T* pointer; typedef const T& reference; istream_iterator() : stream(&cin), end_marker(false) {} istream_iterator(istream& s) : stream(&s) { read(); } reference operator*() const { return value; } pointer operator->() const { return &(operator*()); } istream_iterator& operator++() { read(); return *this; } istream_iterator operator++(int) { istream_iterator tmp = *this; read(); return tmp; } }; # 748 "/usr/local/include/g++/iterator.h" 3 template bool operator==(const istream_iterator& x, const istream_iterator& y) { return x.stream == y.stream && x.end_marker == y.end_marker || x.end_marker == false && y.end_marker == false; } template class ostream_iterator { protected: ostream* stream; const char* 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) : stream(&s), string(0) {} ostream_iterator(ostream& s, const char* c) : stream(&s), string(c) {} ostream_iterator& operator=(const T& value) { *stream << value; if (string) *stream << string; return *this; } ostream_iterator& operator*() { return *this; } ostream_iterator& operator++() { return *this; } ostream_iterator& operator++(int) { return *this; } }; # 789 "/usr/local/include/g++/iterator.h" 3 # 34 "/usr/local/include/g++/algobase.h" 2 3 # 1 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/new.h" 1 3 # 1 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/new" 1 3 #pragma interface "new" # 1 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 1 3 # 327 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 8 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/new" 2 3 # 1 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/exception" 1 3 #pragma interface "exception" extern "C++" { 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 (void); unexpected_handler set_unexpected (unexpected_handler); void unexpected (void); bool uncaught_exception (); } # 9 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/new" 2 3 extern "C++" { 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)(); extern "C" new_handler set_new_handler (new_handler); extern new_handler __new_handler; extern "C" void __default_new_handler (void); void *operator new (size_t); void *operator new (size_t, const nothrow_t&) throw(); void *operator new[] (size_t); void *operator new[] (size_t, const nothrow_t&) throw(); void operator delete (void *) throw(); void operator delete[] (void *) 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/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/new.h" 2 3 # 35 "/usr/local/include/g++/algobase.h" 2 3 # 1 "/usr/local/include/g++/type_traits.h" 1 3 struct __true_type { }; struct __false_type { }; template 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; }; struct __type_traits { 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; }; struct __type_traits { 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; }; struct __type_traits { 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; }; struct __type_traits { 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; }; struct __type_traits { 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; }; struct __type_traits { 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; }; struct __type_traits { 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; }; struct __type_traits { 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; }; struct __type_traits { 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; }; struct __type_traits { 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; }; struct __type_traits { 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; }; struct __type_traits { 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 { 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; }; # 224 "/usr/local/include/g++/type_traits.h" 3 # 36 "/usr/local/include/g++/algobase.h" 2 3 template inline void __iter_swap(ForwardIterator1 a, ForwardIterator2 b, T*) { T tmp = *a; *a = *b; *b = tmp; } template inline void iter_swap(ForwardIterator1 a, ForwardIterator2 b) { __iter_swap(a, b, value_type(a)); } template inline void swap(T& a, T& b) { T tmp = a; a = b; b = tmp; } template inline const T& min(const T& a, const T& b) { return b < a ? b : a; } template inline const T& max(const T& a, const T& b) { return a < b ? b : a; } template inline const T& min(const T& a, const T& b, Compare comp) { return comp(b, a) ? b : a; } template inline const T& max(const T& a, const T& b, Compare comp) { return comp(a, b) ? b : a; } template inline void __distance(InputIterator first, InputIterator last, Distance& n, input_iterator_tag) { while (first != last) { ++first; ++n; } } template inline void __distance(RandomAccessIterator first, RandomAccessIterator last, Distance& n, random_access_iterator_tag) { n += last - first; } template inline void distance(InputIterator first, InputIterator last, Distance& n) { __distance(first, last, n, iterator_category(first)); } template inline iterator_traits::difference_type __distance(InputIterator first, InputIterator last, input_iterator_tag) { iterator_traits::difference_type n = 0; while (first != last) { ++first; ++n; } return n; } template inline iterator_traits::difference_type __distance(RandomAccessIterator first, RandomAccessIterator last, random_access_iterator_tag) { return last - first; } template inline iterator_traits::difference_type distance(InputIterator first, InputIterator last) { return __distance(first, last, iterator_traits::iterator_category()); } template inline void __advance(InputIterator& i, Distance n, input_iterator_tag) { while (n--) ++i; } template inline void __advance(BidirectionalIterator& i, Distance n, bidirectional_iterator_tag) { if (n >= 0) while (n--) ++i; else while (n++) --i; } template inline void __advance(RandomAccessIterator& i, Distance n, random_access_iterator_tag) { i += n; } template inline void advance(InputIterator& i, Distance n) { __advance(i, n, iterator_category(i)); } template inline OutputIterator __copy(InputIterator first, InputIterator last, OutputIterator result, input_iterator_tag) { for ( ; first != last; ++result, ++first) *result = *first; return result; } template inline OutputIterator __copy_d(RandomAccessIterator first, RandomAccessIterator last, OutputIterator result, Distance*) { for (Distance n = last - first; n > 0; --n, ++result, ++first) *result = *first; return result; } template inline OutputIterator __copy(RandomAccessIterator first, RandomAccessIterator last, OutputIterator result, random_access_iterator_tag) { return __copy_d(first, last, result, distance_type(first)); } template struct __copy_dispatch { OutputIterator operator()(InputIterator first, InputIterator last, OutputIterator result) { return __copy(first, last, result, iterator_category(first)); } }; template inline T* __copy_t(const T* first, const T* last, T* result, __true_type) { memmove(result, first, sizeof(T) * (last - first)); return result + (last - first); } template inline T* __copy_t(const T* first, const T* last, T* result, __false_type) { return __copy_d(first, last, result, (ptrdiff_t*) 0); } template struct __copy_dispatch { T* operator()(T* first, T* last, T* result) { return __copy_t(first, last, result, __type_traits::has_trivial_assignment_operator()); } }; template struct __copy_dispatch { T* operator()(const T* first, const T* last, T* result) { return __copy_t(first, last, result, __type_traits::has_trivial_assignment_operator()); } }; template inline OutputIterator copy(InputIterator first, InputIterator last, OutputIterator result) { return __copy_dispatch()(first, last, result); } inline char* copy(const char* first, const char* last, char* result) { memmove(result, first, last - first); return result + (last - first); } inline wchar_t* 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 inline BidirectionalIterator2 __copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, BidirectionalIterator2 result) { while (first != last) *--result = *--last; return result; } template struct __copy_backward_dispatch { BidirectionalIterator2 operator()(BidirectionalIterator1 first, BidirectionalIterator1 last, BidirectionalIterator2 result) { return __copy_backward(first, last, result); } }; template inline T* __copy_backward_t(const T* first, const T* last, T* result, __true_type) { const ptrdiff_t N = last - first; memmove(result - N, first, sizeof(T) * N); return result - N; } template inline T* __copy_backward_t(const T* first, const T* last, T* result, __false_type) { return __copy_backward(first, last, result); } template struct __copy_backward_dispatch { T* operator()(T* first, T* last, T* result) { return __copy_backward_t(first, last, result, __type_traits::has_trivial_assignment_operator()); } }; template struct __copy_backward_dispatch { T* operator()(const T* first, const T* last, T* result) { return __copy_backward_t(first, last, result, __type_traits::has_trivial_assignment_operator()); } }; template inline BidirectionalIterator2 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, BidirectionalIterator2 result) { return __copy_backward_dispatch()(first, last, result); } template OutputIterator __copy_n(InputIterator first, Size count, OutputIterator result, input_iterator_tag) { for ( ; count > 0; --count, ++first, ++result) *result = *first; return result; } template inline OutputIterator __copy_n(RandomAccessIterator first, Size count, OutputIterator result, random_access_iterator_tag) { return copy(first, first + count, result); } template inline OutputIterator copy_n(InputIterator first, Size count, OutputIterator result) { return __copy_n(first, count, result, iterator_category(first)); } template void fill(ForwardIterator first, ForwardIterator last, const T& value) { for ( ; first != last; ++first) *first = value; } template OutputIterator fill_n(OutputIterator first, Size n, const T& value) { for ( ; n > 0; --n, ++first) *first = value; return first; } template pair mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2) { while (first1 != last1 && *first1 == *first2) { ++first1; ++first2; } return pair(first1, first2); } template pair mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate binary_pred) { while (first1 != last1 && binary_pred(*first1, *first2)) { ++first1; ++first2; } return pair(first1, first2); } template inline bool equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2) { for ( ; first1 != last1; ++first1, ++first2) if (*first1 != *first2) return false; return true; } template inline bool equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate binary_pred) { for ( ; first1 != last1; ++first1, ++first2) if (!binary_pred(*first1, *first2)) return false; return true; } template bool lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2) { for ( ; first1 != last1 && first2 != last2; ++first1, ++first2) { if (*first1 < *first2) return true; if (*first2 < *first1) return false; } return first1 == last1 && first2 != last2; } template bool lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 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 int lexicographical_compare_3way(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 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 int len1 = last1 - first1; const int len2 = last2 - first2; const int result = memcmp(first1, first2, min(len1, len2)); return result == 0 ? len1 - len2 : result; } 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 inline void destroy(T* pointer) { pointer->~T(); } template inline void construct(T1* p, const T2& value) { new (p) T1(value); } template inline void __destroy_aux(ForwardIterator first, ForwardIterator last, __false_type) { for ( ; first < last; ++first) destroy(&*first); } template inline void __destroy_aux(ForwardIterator, ForwardIterator, __true_type) { } template inline void __destroy(ForwardIterator first, ForwardIterator last, T*) { __destroy_aux(first, last, __type_traits::has_trivial_destructor()); } template 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*) {} template inline ForwardIterator __uninitialized_copy_aux(InputIterator first, InputIterator last, ForwardIterator result, __true_type) { return copy(first, last, result); } template ForwardIterator __uninitialized_copy_aux(InputIterator first, InputIterator last, ForwardIterator result, __false_type) { ForwardIterator cur = result; try { for ( ; first != last; ++first, ++cur) construct(&*cur, *first); return cur; } catch(...) { destroy(result, cur); throw; } } template inline ForwardIterator __uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator result, T*) { return __uninitialized_copy_aux(first, last, result, __type_traits::is_POD_type()); } template inline ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator 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 ForwardIterator __uninitialized_copy_n(InputIterator first, Size count, ForwardIterator result, input_iterator_tag) { ForwardIterator cur = result; try { for ( ; count > 0 ; --count, ++first, ++cur) construct(&*cur, *first); return cur; } catch(...) { destroy(result, cur); throw; } } template inline ForwardIterator __uninitialized_copy_n(RandomAccessIterator first, Size count, ForwardIterator result, random_access_iterator_tag) { return uninitialized_copy(first, first + count, result); } template inline ForwardIterator uninitialized_copy_n(InputIterator first, Size count, ForwardIterator result) { return __uninitialized_copy_n(first, count, result, iterator_category(first)); } template inline void __uninitialized_fill_aux(ForwardIterator first, ForwardIterator last, const T& x, __true_type) { fill(first, last, x); } template void __uninitialized_fill_aux(ForwardIterator first, ForwardIterator last, const T& x, __false_type) { ForwardIterator cur = first; try { for ( ; cur != last; ++cur) construct(&*cur, x); } catch(...) { destroy(first, cur); throw; } } template inline void __uninitialized_fill(ForwardIterator first, ForwardIterator last, const T& x, T1*) { __uninitialized_fill_aux(first, last, x, __type_traits::is_POD_type()); } template inline void uninitialized_fill(ForwardIterator first, ForwardIterator last, const T& x) { __uninitialized_fill(first, last, x, value_type(first)); } template inline ForwardIterator __uninitialized_fill_n_aux(ForwardIterator first, Size n, const T& x, __true_type) { return fill_n(first, n, x); } template ForwardIterator __uninitialized_fill_n_aux(ForwardIterator first, Size n, const T& x, __false_type) { ForwardIterator cur = first; try { for ( ; n > 0; --n, ++cur) construct(&*cur, x); return cur; } catch(...) { destroy(first, cur); throw; } } template inline ForwardIterator __uninitialized_fill_n(ForwardIterator first, Size n, const T& x, T1*) { return __uninitialized_fill_n_aux(first, n, x, __type_traits::is_POD_type()); } template inline ForwardIterator uninitialized_fill_n(ForwardIterator first, Size n, const T& x) { return __uninitialized_fill_n(first, n, x, value_type(first)); } template inline ForwardIterator __uninitialized_copy_copy(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, ForwardIterator result) { ForwardIterator mid = uninitialized_copy(first1, last1, result); try { return uninitialized_copy(first2, last2, mid); } catch(...) { destroy(result, mid); throw; } } template inline ForwardIterator __uninitialized_fill_copy(ForwardIterator result, ForwardIterator mid, const T& x, InputIterator first, InputIterator last) { uninitialized_fill(result, mid, x); try { return uninitialized_copy(first, last, mid); } catch(...) { destroy(result, mid); throw; } } template inline void __uninitialized_copy_fill(InputIterator first1, InputIterator last1, ForwardIterator first2, ForwardIterator last2, const T& x) { ForwardIterator mid2 = uninitialized_copy(first1, last1, first2); try { uninitialized_fill(mid2, last2, x); } catch(...) { destroy(first2, mid2); throw; } } # 31 "/usr/local/include/g++/vector.h" 2 3 # 1 "/usr/local/include/g++/alloc.h" 1 3 # 1 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 1 3 # 327 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 54 "/usr/local/include/g++/alloc.h" 2 3 # 1 "/usr/include/stdlib.h" 1 3 # 1 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 1 3 # 19 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 61 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 126 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 182 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 256 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 302 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 34 "/usr/include/stdlib.h" 2 3 # 1 "/usr/include/errno.h" 1 3 # 1 "/usr/include/linux/errno.h" 1 3 # 1 "/usr/include/asm/errno.h" 1 3 # 4 "/usr/include/linux/errno.h" 2 3 # 14 "/usr/include/linux/errno.h" 3 # 27 "/usr/include/errno.h" 2 3 extern int sys_nerr; extern char *sys_errlist[]; extern int _sys_nerr; extern char *_sys_errlist[]; extern "C" { extern void perror (__const char* __s) ; extern char* strerror (int __errno) ; extern int errno; } # 42 "/usr/include/stdlib.h" 2 3 extern "C" { typedef struct { int quot; int rem; } div_t; typedef struct { long int quot; long int rem; } ldiv_t; extern double atof (__const char *__nptr) ; extern int atoi (__const char *__nptr) ; extern long int atol (__const char *__nptr) ; extern long long int atoq (__const char *__nptr) ; extern float strtof (__const char *__nptr, char **__endptr) ; extern double strtod (__const char *__nptr, char **__endptr) ; extern __long_double_t strtold (__const char *__nptr, char **__endptr) ; extern long int strtol (__const char *__nptr, char **__endptr, int __base) ; extern unsigned long int strtoul (__const char *__nptr, char **__endptr, int __base) ; extern long long int strtoq (__const char *__nptr, char **__endptr, int __base) ; extern unsigned long long int strtouq (__const char *__nptr, char **__endptr, int __base) ; extern double __strtod_internal (__const char *__nptr, char **__endptr, int __group); extern float __strtof_internal (__const char *__nptr, char **__endptr, int __group); extern __long_double_t __strtold_internal (__const char *__nptr, char **__endptr, int __group); extern long int __strtol_internal (__const char *__nptr, char **__endptr, int __base, int __group); extern unsigned long int __strtoul_internal (__const char *__nptr, char **__endptr, int __base, int __group); extern long long int __strtoq_internal (__const char *__nptr, char **__endptr, int __base, int __group); extern unsigned long long int __strtouq_internal (__const char *__nptr, char **__endptr, int __base, int __group); # 170 "/usr/include/stdlib.h" 3 extern int rand (void) ; extern void srand (unsigned int __seed) ; extern long int __random (void) ; extern void __srandom (unsigned int __seed) ; extern void * __initstate (unsigned int __seed, void * __statebuf, size_t __statelen) ; extern void * __setstate (void * __statebuf) ; extern long int random (void) ; extern void srandom (unsigned int __seed) ; extern void * initstate (unsigned int __seed, void * __statebuf, size_t __statelen) ; extern void * setstate (void * __statebuf) ; # 214 "/usr/include/stdlib.h" 3 extern void * malloc (size_t __size) ; extern void * realloc (void * __ptr, size_t __size) ; extern void * calloc (size_t __nmemb, size_t __size) ; extern void free (void * __ptr) ; extern void cfree (void * __ptr) ; # 1 "/usr/include/alloca.h" 1 3 # 1 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 1 3 # 19 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 61 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 126 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 182 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 256 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 302 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 24 "/usr/include/alloca.h" 2 3 extern "C" { extern void * __alloca (size_t __size) ; } # 234 "/usr/include/stdlib.h" 2 3 extern void * valloc (size_t __size) ; extern void abort (void) ; extern int atexit (void (*__func) (void)) ; extern int on_exit (void (*__func) (int __status, void * __arg), void * __arg) ; extern void exit (int __status) ; extern char *getenv (__const char *__name) ; extern int putenv (__const char *__string) ; extern int setenv (__const char *__name, __const char *__value, int __replace) ; extern int system (__const char *__command) ; typedef int (*__compar_fn_t) (__const void * , __const void * ) ; typedef __compar_fn_t comparison_fn_t; extern void * bsearch (__const void * __key, __const void * __base, size_t __nmemb, size_t __size, __compar_fn_t __compar) ; extern void qsort (void * __base, size_t __nmemb, size_t __size, __compar_fn_t __compar) ; # 314 "/usr/include/stdlib.h" 3 extern int abs (int __x) ; extern long int labs (long int __x) ; extern div_t div (int __numer, int __denom) ; extern ldiv_t ldiv (long int __numer, long int __denom) ; extern int mblen (__const char *__s, size_t __n) ; extern int mbtowc (wchar_t * __pwc, __const char *__s, size_t __n) ; extern int wctomb (char *__s, wchar_t __wchar) ; extern size_t mbstowcs (wchar_t * __pwcs, __const char *__s, size_t __n) ; extern size_t wcstombs (char *__s, __const wchar_t * __pwcs, size_t __n) ; # 375 "/usr/include/stdlib.h" 3 extern char **environ; extern char **__environ; extern char* ecvt (double __value, size_t __ndigit, int *__decpt, int *__sign) ; extern char* fcvt (double __value, size_t __ndigit, int *__decpt, int *__sign) ; extern char* gcvt (double __value, size_t __ndigit, char *__buf) ; extern double drand48 (void) ; extern double erand48 (unsigned short int __xsubi[3]) ; extern long int lrand48 (void) ; extern long int nrand48 (unsigned short int __xsubi[3]) ; extern long int mrand48 (void) ; extern long int jrand48 (unsigned short int __xsubi[3]) ; extern void srand48 (long int __seedval) ; extern unsigned short int *seed48 (unsigned short int __seed16v[3]) ; extern void lcong48 (unsigned short int __param[7]) ; extern int setenv (__const char *__name, __const char *__value, int __overwrite) ; extern void unsetenv (__const char *__name) ; struct qelem { struct qelem *q_forw; struct qelem *q_back; char q_data[1]; }; extern void insque (struct qelem *__elem, struct qelem *__prev) ; extern void remque (struct qelem *__elem) ; } # 55 "/usr/local/include/g++/alloc.h" 2 3 # 1 "/usr/include/assert.h" 1 3 # 53 "/usr/include/assert.h" 3 extern "C" { extern void __assert_fail (__const char *__assertion, __const char *__file, unsigned int __line, __const char *__function) __attribute__ ((__noreturn__)); extern void __assert_perror_fail (int __errnum, __const char *__file, unsigned int __line, __const char *__function) __attribute__ ((__noreturn__)); } # 57 "/usr/local/include/g++/alloc.h" 2 3 # 78 "/usr/local/include/g++/alloc.h" 3 # 88 "/usr/local/include/g++/alloc.h" 3 # 104 "/usr/local/include/g++/alloc.h" 3 template class __malloc_alloc_template { private: static void *oom_malloc(size_t); static void *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 = 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 = 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 void (* __malloc_alloc_template::__malloc_alloc_oom_handler)() = 0; template void * __malloc_alloc_template::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 void * __malloc_alloc_template::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 simple_alloc { public: static T *allocate(size_t n) { return 0 == n? 0 : (T*) Alloc::allocate(n * sizeof (T)); } static T *allocate(void) { return (T*) Alloc::allocate(sizeof (T)); } static void deallocate(T *p, size_t n) { if (0 != n) Alloc::deallocate(p, n * sizeof (T)); } static void deallocate(T *p) { Alloc::deallocate(p, sizeof (T)); } }; template class debug_alloc { private: enum {extra = 8}; public: static void * allocate(size_t n) { char *result = (char *)Alloc::allocate(n + extra); *(size_t *)result = n; return result + extra; } static void deallocate(void *p, size_t n) { char * real_p = (char *)p - extra; ((void) (( *(size_t *)real_p == n ) || (__assert_fail ("*(size_t *)real_p == n" , "/usr/local/include/g++/alloc.h", 250, __PRETTY_FUNCTION__ ), 0))) ; Alloc::deallocate(real_p, n + extra); } static void * reallocate(void *p, size_t old_sz, size_t new_sz) { char * real_p = (char *)p - extra; ((void) (( *(size_t *)real_p == old_sz ) || (__assert_fail ("*(size_t *)real_p == old_sz" , "/usr/local/include/g++/alloc.h", 257, __PRETTY_FUNCTION__ ), 0))) ; char * result = (char *) Alloc::reallocate(real_p, old_sz + extra, new_sz + extra); *(size_t *)result = new_sz; return result + extra; } }; template class __default_alloc_template { private: enum {__ALIGN = 8}; enum {__MAX_BYTES = 128}; enum {__NFREELISTS = __MAX_BYTES/__ALIGN}; static size_t ROUND_UP(size_t bytes) { return (((bytes) + __ALIGN-1) & ~(__ALIGN - 1)); } private : union obj { union obj * free_list_link; char client_data[1]; }; private: static obj * free_list[__NFREELISTS]; static size_t FREELIST_INDEX(size_t bytes) { return (((bytes) + __ALIGN-1)/__ALIGN - 1); } static void *refill(size_t n); static char *chunk_alloc(size_t size, int &nobjs); static char *start_free; static char *end_free; static size_t heap_size; # 372 "/usr/local/include/g++/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 = free_list + FREELIST_INDEX(n); result = *my_free_list; if (result == 0) { void *r = refill(ROUND_UP(n)); return r; } *my_free_list = result -> 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 = free_list + FREELIST_INDEX(n); q -> 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 single_client_alloc; template char* __default_alloc_template::chunk_alloc(size_t size, int& nobjs) { char * result; size_t total_bytes = size * nobjs; size_t bytes_left = end_free - start_free; if (bytes_left >= total_bytes) { result = start_free; start_free += total_bytes; return(result); } else if (bytes_left >= size) { nobjs = bytes_left/size; total_bytes = size * nobjs; result = start_free; start_free += total_bytes; return(result); } else { size_t bytes_to_get = 2 * total_bytes + ROUND_UP(heap_size >> 4); if (bytes_left > 0) { obj * * my_free_list = free_list + FREELIST_INDEX(bytes_left); ((obj *)start_free) -> free_list_link = *my_free_list; *my_free_list = (obj *)start_free; } start_free = (char *)malloc(bytes_to_get); if (0 == start_free) { int i; obj * * my_free_list, *p; for (i = size; i <= __MAX_BYTES; i += __ALIGN) { my_free_list = free_list + FREELIST_INDEX(i); p = *my_free_list; if (0 != p) { *my_free_list = p -> free_list_link; start_free = (char *)p; end_free = start_free + i; return(chunk_alloc(size, nobjs)); } } end_free = 0; start_free = (char *)malloc_alloc::allocate(bytes_to_get); } heap_size += bytes_to_get; end_free = start_free + bytes_to_get; return(chunk_alloc(size, nobjs)); } } template void* __default_alloc_template::refill(size_t n) { int nobjs = 20; char * chunk = chunk_alloc(n, nobjs); obj * * my_free_list; obj * result; obj * current_obj, * next_obj; int i; if (1 == nobjs) return(chunk); my_free_list = free_list + 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 -> free_list_link = 0; break; } else { current_obj -> free_list_link = next_obj; } } return(result); } template void* __default_alloc_template::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 (ROUND_UP(old_sz) == 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); } # 645 "/usr/local/include/g++/alloc.h" 3 template char *__default_alloc_template::start_free = 0; template char *__default_alloc_template::end_free = 0; template size_t __default_alloc_template::heap_size = 0; template __default_alloc_template::obj * __default_alloc_template ::free_list[ __default_alloc_template::__NFREELISTS ] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; # 32 "/usr/local/include/g++/vector.h" 2 3 template class vector { public: typedef T value_type; typedef value_type* pointer; typedef value_type* iterator; typedef const value_type* const_iterator; typedef value_type& reference; typedef const value_type& const_reference; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef reverse_iterator const_reverse_iterator; typedef reverse_iterator reverse_iterator; protected: typedef simple_alloc data_allocator; iterator start; iterator finish; iterator end_of_storage; void insert_aux(iterator position, const T& x); void deallocate() { if (start) data_allocator::deallocate(start, end_of_storage - start); } public: iterator begin() { return start; } const_iterator begin() const { return start; } iterator end() { return finish; } const_iterator end() const { return finish; } 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()); } size_type size() const { return size_type(end() - begin()); } size_type max_size() const { return size_type(-1); } size_type capacity() const { return size_type(end_of_storage - begin()); } bool empty() const { return begin() == end(); } reference operator[](size_type n) { return *(begin() + n); } const_reference operator[](size_type n) const { return *(begin() + n); } vector() : start(0), finish(0), end_of_storage(0) {} vector(size_type n, const T& value) { start = allocate_and_fill(n, value); finish = start + n; end_of_storage = finish; } explicit vector(size_type n) { start = allocate_and_fill(n, T()); finish = start + n; end_of_storage = finish; } vector(const vector& x) { start = allocate_and_copy(x.end() - x.begin(), x.begin(), x.end()); finish = start + (x.end() - x.begin()); end_of_storage = finish; } template vector(InputIterator first, InputIterator last) : start(0), finish(0), end_of_storage(0) { range_initialize(first, last, iterator_category(first)); } # 113 "/usr/local/include/g++/vector.h" 3 ~vector() { destroy(start, finish); deallocate(); } vector& operator=(const vector& x); void reserve(size_type n) { if (capacity() < n) { const size_type old_size = size(); const iterator tmp = allocate_and_copy(n, start, finish); destroy(start, finish); deallocate(); start = tmp; finish = tmp + old_size; end_of_storage = start + n; } } reference front() { return *begin(); } const_reference front() const { return *begin(); } reference back() { return *(end() - 1); } const_reference back() const { return *(end() - 1); } void push_back(const T& x) { if (finish != end_of_storage) { construct(finish, x); ++finish; } else insert_aux(end(), x); } void swap(vector& x) { ::swap(start, x.start); ::swap(finish, x.finish); ::swap(end_of_storage, x.end_of_storage); } iterator insert(iterator position, const T& x) { size_type n = position - begin(); if (finish != end_of_storage && position == end()) { construct(finish, x); ++finish; } else insert_aux(position, x); return begin() + n; } iterator insert(iterator position) { return insert(position, T()); } template void insert(iterator position, InputIterator first, InputIterator last) { range_insert(position, first, last, iterator_category(first)); } void insert (iterator position, size_type n, const T& x); void pop_back() { --finish; destroy(finish); } void erase(iterator position) { if (position + 1 != end()) copy(position + 1, finish, position); --finish; destroy(finish); } void erase(iterator first, iterator last) { iterator i = copy(last, finish, first); destroy(i, finish); finish = finish - (last - first); } void resize(size_type new_size, const T& x) { if (new_size < size()) erase(begin() + new_size, end()); else insert(end(), new_size - size(), x); } void resize(size_type new_size) { resize(new_size, T()); } void clear() { erase(begin(), end()); } protected: iterator allocate_and_fill(size_type n, const T& x) { iterator result = data_allocator::allocate(n); try { uninitialized_fill_n(result, n, x); return result; } catch(...) { data_allocator::deallocate(result, n); throw; } } template iterator allocate_and_copy(size_type n, ForwardIterator first, ForwardIterator last) { iterator result = data_allocator::allocate(n); try { uninitialized_copy(first, last, result); return result; } catch(...) { data_allocator::deallocate(result, n); throw; } } # 242 "/usr/local/include/g++/vector.h" 3 template void range_initialize(InputIterator first, InputIterator last, input_iterator_tag) { for ( ; first != last; ++first) push_back(*first); } template void range_initialize(ForwardIterator first, ForwardIterator last, forward_iterator_tag) { size_type n = 0; distance(first, last, n); start = allocate_and_copy(n, first, last); finish = start + n; end_of_storage = finish; } template void range_insert(iterator pos, InputIterator first, InputIterator last, input_iterator_tag); template void range_insert(iterator pos, ForwardIterator first, ForwardIterator last, forward_iterator_tag); }; template inline bool operator==(const vector& x, const vector& y) { return x.size() == y.size() && equal(x.begin(), x.end(), y.begin()); } template inline bool operator<(const vector& x, const vector& y) { return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } template vector& vector::operator=(const vector& x) { if (&x != this) { if (x.size() > capacity()) { const iterator tmp = allocate_and_copy(x.end() - x.begin(), x.begin(), x.end()); destroy(start, finish); deallocate(); start = tmp; end_of_storage = start + (x.end() - x.begin()); } else if (size() >= x.size()) { iterator i = copy(x.begin(), x.end(), begin()); destroy(i, finish); } else { copy(x.begin(), x.begin() + size(), start); uninitialized_copy(x.begin() + size(), x.end(), finish); } finish = start + x.size(); } return *this; } template void vector::insert_aux(iterator position, const T& x) { if (finish != end_of_storage) { construct(finish, *(finish - 1)); ++finish; T x_copy = x; copy_backward(position, finish - 2, finish - 1); *position = x_copy; } else { const size_type old_size = size(); const size_type len = old_size != 0 ? 2 * old_size : 1; const iterator new_start = data_allocator::allocate(len); iterator new_finish = new_start; try { new_finish = uninitialized_copy(start, position, new_start); construct(new_finish, x); ++new_finish; new_finish = uninitialized_copy(position, finish, new_finish); } catch(...) { destroy(new_start, new_finish); data_allocator::deallocate(new_start, len); throw; } destroy(begin(), end()); deallocate(); start = new_start; finish = new_finish; end_of_storage = new_start + len; } } template void vector::insert(iterator position, size_type n, const T& x) { if (n != 0) { if (size_type (end_of_storage - finish) >= n) { T x_copy = x; const size_type elems_after = finish - position; const iterator old_finish = finish; if (elems_after > n) { uninitialized_copy(finish - n, finish, finish); finish += n; copy_backward(position, old_finish - n, old_finish); fill(position, position + n, x_copy); } else { uninitialized_fill_n(finish, n - elems_after, x_copy); finish += n - elems_after; uninitialized_copy(position, old_finish, finish); finish += elems_after; fill(position, old_finish, x_copy); } } else { const size_type old_size = size(); const size_type len = old_size + max(old_size, n); const iterator new_start = data_allocator::allocate(len); iterator new_finish = new_start; try { new_finish = uninitialized_copy(start, position, new_start); new_finish = uninitialized_fill_n(new_finish, n, x); new_finish = uninitialized_copy(position, finish, new_finish); } catch(...) { destroy(new_start, new_finish); data_allocator::deallocate(new_start, len); throw; } destroy(start, finish); deallocate(); start = new_start; finish = new_finish; end_of_storage = new_start + len; } } } template template void vector::range_insert(iterator pos, InputIterator first, InputIterator last, input_iterator_tag) { for ( ; first != last; ++first) { pos = insert(pos, *first); ++pos; } } template template void vector::range_insert(iterator position, ForwardIterator first, ForwardIterator last, forward_iterator_tag) { if (first != last) { size_type n = 0; distance(first, last, n); if (size_type (end_of_storage - finish) >= n) { const size_type elems_after = finish - position; const iterator old_finish = finish; if (elems_after > n) { uninitialized_copy(finish - n, finish, finish); finish += n; copy_backward(position, old_finish - n, old_finish); copy(first, last, position); } else { ForwardIterator mid = first; advance(mid, elems_after); uninitialized_copy(mid, last, finish); finish += n - elems_after; uninitialized_copy(position, old_finish, finish); finish += elems_after; copy(first, mid, position); } } else { const size_type old_size = size(); const size_type len = old_size + max(old_size, n); const iterator new_start = data_allocator::allocate(len); iterator new_finish = new_start; try { new_finish = uninitialized_copy(start, position, new_start); new_finish = uninitialized_copy(first, last, new_finish); new_finish = uninitialized_copy(position, finish, new_finish); } catch(...) { destroy(new_start, new_finish); data_allocator::deallocate(new_start, len); throw; } destroy(start, finish); deallocate(); start = new_start; finish = new_finish; end_of_storage = new_start + len; } } } # 521 "/usr/local/include/g++/vector.h" 3 # 6 "/usr/local/include/g++/vector" 2 3 # 3 "z.cc" 2 # 1 "/usr/local/include/g++/string" 1 3 # 1 "/usr/local/include/g++/std/bastring.h" 1 3 #pragma interface # 1 "/usr/local/include/g++/cstddef" 1 3 # 1 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 1 3 # 327 "/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.11/include/stddef.h" 3 # 6 "/usr/local/include/g++/cstddef" 2 3 # 35 "/usr/local/include/g++/std/bastring.h" 2 3 # 1 "/usr/local/include/g++/std/straits.h" 1 3 #pragma interface "std/straits.h" extern "C++" { template 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/local/include/g++/cctype" 1 3 # 1 "/usr/include/ctype.h" 1 3 extern "C" { # 1 "/usr/include/endian.h" 1 3 # 1 "/usr/include/bytesex.h" 1 3 # 34 "/usr/include/endian.h" 2 3 # 44 "/usr/include/ctype.h" 2 3 enum { _ISupper = ( 0 < 8 ? ((1 << 0 ) << 8) : ((1 << 0 ) >> 8)) , _ISlower = ( 1 < 8 ? ((1 << 1 ) << 8) : ((1 << 1 ) >> 8)) , _ISalpha = ( 2 < 8 ? ((1 << 2 ) << 8) : ((1 << 2 ) >> 8)) , _ISdigit = ( 3 < 8 ? ((1 << 3 ) << 8) : ((1 << 3 ) >> 8)) , _ISxdigit = ( 4 < 8 ? ((1 << 4 ) << 8) : ((1 << 4 ) >> 8)) , _ISspace = ( 5 < 8 ? ((1 << 5 ) << 8) : ((1 << 5 ) >> 8)) , _ISprint = ( 6 < 8 ? ((1 << 6 ) << 8) : ((1 << 6 ) >> 8)) , _ISgraph = ( 7 < 8 ? ((1 << 7 ) << 8) : ((1 << 7 ) >> 8)) , _ISblank = ( 8 < 8 ? ((1 << 8 ) << 8) : ((1 << 8 ) >> 8)) , _IScntrl = ( 9 < 8 ? ((1 << 9 ) << 8) : ((1 << 9 ) >> 8)) , _ISpunct = ( 10 < 8 ? ((1 << 10 ) << 8) : ((1 << 10 ) >> 8)) , _ISalnum = ( 11 < 8 ? ((1 << 11 ) << 8) : ((1 << 11 ) >> 8)) }; extern __const unsigned short int *__ctype_b; extern __const int *__ctype_tolower; extern __const int *__ctype_toupper; extern int isalnum (int) ; extern int isalpha (int) ; extern int iscntrl (int) ; extern int isdigit (int) ; extern int islower (int) ; extern int isgraph (int) ; extern int isprint (int) ; extern int ispunct (int) ; extern int isspace (int) ; extern int isupper (int) ; extern int isxdigit (int) ; extern int isblank (int) ; extern int tolower (int __c) ; extern int toupper (int __c) ; extern int isascii (int __c) ; extern int toascii (int __c) ; extern int _toupper (int) ; extern int _tolower (int) ; } # 6 "/usr/local/include/g++/cctype" 2 3 # 105 "/usr/local/include/g++/std/straits.h" 2 3 # 1 "/usr/local/include/g++/cstring" 1 3 # 94 "/usr/local/include/g++/cstring" 3 # 106 "/usr/local/include/g++/std/straits.h" 2 3 struct string_char_traits { 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 ((__ctype_b[(int) ( ( a ) )] & (unsigned short int) _ISspace ) != 0) ; } 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/local/include/g++/std/straits.h" 3 } # 36 "/usr/local/include/g++/std/bastring.h" 2 3 # 1 "/usr/local/include/g++/stdexcept" 1 3 #pragma interface "stdexcept" # 1 "/usr/local/include/g++/string" 1 3 # 13 "/usr/local/include/g++/string" 3 # 36 "/usr/local/include/g++/stdexcept" 2 3 extern "C++" { class logic_error : public exception { string _what; public: logic_error(const string& what_arg): _what (what_arg) { } virtual const char* what () const { return _what.c_str (); } }; class domain_error : public logic_error { public: domain_error (const string& what_arg): logic_error (what_arg) { } }; class invalid_argument : public logic_error { public: invalid_argument (const string& what_arg): logic_error (what_arg) { } }; class length_error : public logic_error { public: length_error (const string& what_arg): logic_error (what_arg) { } }; class out_of_range : public logic_error { public: out_of_range (const string& what_arg): logic_error (what_arg) { } }; class runtime_error : public exception { string _what; public: runtime_error(const string& what_arg): _what (what_arg) { } virtual const char* what () const { return _what.c_str (); } protected: runtime_error(): exception () { } }; class range_error : public runtime_error { public: range_error (const string& what_arg): runtime_error (what_arg) { } }; class overflow_error : public runtime_error { public: overflow_error (const string& what_arg): runtime_error (what_arg) { } }; class underflow_error : public runtime_error { public: underflow_error (const string& what_arg): runtime_error (what_arg) { } }; } # 40 "/usr/local/include/g++/std/bastring.h" 2 3 extern "C++" { class istream; class ostream; # 1 "/usr/local/include/g++/iterator" 1 3 # 57 "/usr/local/include/g++/std/bastring.h" 2 3 template > class basic_string { private: struct Rep { size_t len, res, ref; bool selfish; charT* data () { return reinterpret_cast(this + 1); } charT& operator[] (size_t s) { return data () [s]; } charT* grab () { if (selfish) return clone (); ++ref; return data (); } void release () { if (--ref == 0) delete this; } inline static void * operator new (size_t, size_t); 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); # 92 "/usr/local/include/g++/std/bastring.h" 3 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 charT value_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 reverse_iterator; typedef ::reverse_iterator const_reverse_iterator; static const size_type npos = static_cast(-1); private: Rep *rep () const { return reinterpret_cast(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 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 basic_string& append(InputIterator first, InputIterator last) { return replace (iend (), iend (), first, last); } 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 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 pos = p - begin (); insert (pos, 1, c); return pos +begin (); } iterator insert(iterator p, size_type n, charT c) { size_type pos = p - begin (); insert (pos, n, c); return pos +begin (); } template void insert(iterator p, InputIterator first, InputIterator last) { replace (p, p, first, last); } basic_string& remove (size_type pos = 0, size_type n = npos) { return replace (pos, n, (size_type)0, (charT)0); } basic_string& remove (iterator pos) { return replace (pos - begin (), 1, (size_type)0, (charT)0); } basic_string& remove (iterator first, iterator last) { return replace (first - begin (), last - first, (size_type)0, (charT)0);} 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 - begin (), i2 - i1, str); } basic_string& replace (iterator i1, iterator i2, const charT* s, size_type n) { return replace (i1 - begin (), i2 - i1, s, n); } basic_string& replace (iterator i1, iterator i2, const charT* s) { return replace (i1 - begin (), i2 - i1, s); } basic_string& replace (iterator i1, iterator i2, size_type n, charT c) { return replace (i1 - begin (), i2 - i1, n, c); } template 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 (capacity (), 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) { unique (); return (*rep ())[pos]; } reference at (size_type pos) { do { if (!( pos >= length () )) throw out_of_range ("pos >= length ()"); } while (0) ; return (*this)[pos]; } const_reference at (size_type pos) const { do { if (!( pos >= length () )) throw 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 { 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); 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 template basic_string & basic_string :: 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 )) throw out_of_range ("pos > len"); } while (0) ; if (n1 > len - pos) n1 = len - pos; do { if (!( len - n1 > max_size () - n2 )) throw 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 inline basic_string operator+ (const basic_string & lhs, const basic_string & rhs) { basic_string str (lhs); str.append (rhs); return str; } template inline basic_string operator+ (const charT* lhs, const basic_string & rhs) { basic_string str (lhs); str.append (rhs); return str; } template inline basic_string operator+ (charT lhs, const basic_string & rhs) { basic_string str (1, lhs); str.append (rhs); return str; } template inline basic_string operator+ (const basic_string & lhs, const charT* rhs) { basic_string str (lhs); str.append (rhs); return str; } template inline basic_string operator+ (const basic_string & lhs, charT rhs) { basic_string str (lhs); str.append (1, rhs); return str; } template inline bool operator== (const basic_string & lhs, const basic_string & rhs) { return (lhs.compare (rhs) == 0); } template inline bool operator== (const charT* lhs, const basic_string & rhs) { return (rhs.compare (lhs) == 0); } template inline bool operator== (const basic_string & lhs, const charT* rhs) { return (lhs.compare (rhs) == 0); } template inline bool operator!= (const charT* lhs, const basic_string & rhs) { return (rhs.compare (lhs) != 0); } template inline bool operator!= (const basic_string & lhs, const charT* rhs) { return (lhs.compare (rhs) != 0); } template inline bool operator< (const basic_string & lhs, const basic_string & rhs) { return (lhs.compare (rhs) < 0); } template inline bool operator< (const charT* lhs, const basic_string & rhs) { return (rhs.compare (lhs) > 0); } template inline bool operator< (const basic_string & lhs, const charT* rhs) { return (lhs.compare (rhs) < 0); } template inline bool operator> (const charT* lhs, const basic_string & rhs) { return (rhs.compare (lhs) < 0); } template inline bool operator> (const basic_string & lhs, const charT* rhs) { return (lhs.compare (rhs) > 0); } template inline bool operator<= (const charT* lhs, const basic_string & rhs) { return (rhs.compare (lhs) >= 0); } template inline bool operator<= (const basic_string & lhs, const charT* rhs) { return (lhs.compare (rhs) <= 0); } template inline bool operator>= (const charT* lhs, const basic_string & rhs) { return (rhs.compare (lhs) <= 0); } template inline bool operator>= (const basic_string & lhs, const charT* rhs) { return (lhs.compare (rhs) >= 0); } template inline bool operator!= (const basic_string & lhs, const basic_string & rhs) { return (lhs.compare (rhs) != 0); } template inline bool operator> (const basic_string & lhs, const basic_string & rhs) { return (lhs.compare (rhs) > 0); } template inline bool operator<= (const basic_string & lhs, const basic_string & rhs) { return (lhs.compare (rhs) <= 0); } template inline bool operator>= (const basic_string & lhs, const basic_string & rhs) { return (lhs.compare (rhs) >= 0); } class istream; class ostream; template istream& operator>> (istream&, basic_string &); template ostream& operator<< (ostream&, const basic_string &); template istream& getline (istream&, basic_string &, charT delim = '\n'); } # 6 "/usr/local/include/g++/string" 2 3 extern "C++" { typedef basic_string string; } # 4 "z.cc" 2 int main() { string s("a_string"); vector v(3,-1.0); cout << "a string: \"" << s << "\" followed by a vector element: " << v[0] << endl; return 1; }