# 1 "push_back_bug.cpp" # 1 "/usr/include/g++/vector" 1 3 # 1 "/usr/include/g++/stl_algobase.h" 1 3 # 1 "/usr/include/g++/stl_config.h" 1 3 # 148 "/usr/include/g++/stl_config.h" 3 # 1 "/usr/include/g++/_G_config.h" 1 3 typedef int _G_int8_t __attribute__((__mode__(__QI__))); typedef unsigned int _G_uint8_t __attribute__((__mode__(__QI__))); typedef int _G_int16_t __attribute__((__mode__(__HI__))); typedef unsigned int _G_uint16_t __attribute__((__mode__(__HI__))); typedef int _G_int32_t __attribute__((__mode__(__SI__))); typedef unsigned int _G_uint32_t __attribute__((__mode__(__SI__))); typedef int _G_int64_t __attribute__((__mode__(__DI__))); typedef unsigned int _G_uint64_t __attribute__((__mode__(__DI__))); __extension__ typedef long long _G_llong; __extension__ typedef unsigned long long _G_ullong; typedef unsigned long _G_clock_t; typedef unsigned int _G_dev_t; typedef int __attribute__((__mode__(__DI__))) _G_fpos_t; typedef unsigned int _G_gid_t; typedef unsigned int _G_ino_t; typedef unsigned short _G_mode_t; typedef unsigned short _G_nlink_t; typedef int __attribute__((__mode__(__DI__))) _G_off_t; typedef int _G_pid_t; typedef int _G_ptrdiff_t; typedef unsigned int _G_sigset_t; typedef unsigned int _G_size_t; typedef long _G_time_t; typedef unsigned int _G_uid_t; typedef int _G_wchar_t; typedef int _G_ssize_t; typedef int _G_wint_t; typedef char * _G_va_list; # 1 "/usr/include/stddef.h" 1 3 # 1 "/usr/include/machine/ansi.h" 1 3 typedef int __attribute__((__mode__(__DI__))) __int64_t; typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t; typedef __signed char __int8_t; typedef unsigned char __uint8_t; typedef short __int16_t; typedef unsigned short __uint16_t; typedef int __int32_t; typedef unsigned int __uint32_t; typedef int __intptr_t; typedef unsigned int __uintptr_t; # 39 "/usr/include/stddef.h" 2 3 typedef int ptrdiff_t; typedef int rune_t; typedef unsigned int size_t; typedef int wchar_t; # 101 "/usr/include/g++/_G_config.h" 2 3 # 151 "/usr/include/g++/stl_config.h" 2 3 # 178 "/usr/include/g++/stl_config.h" 3 # 234 "/usr/include/g++/stl_config.h" 3 # 248 "/usr/include/g++/stl_config.h" 3 # 316 "/usr/include/g++/stl_config.h" 3 # 36 "/usr/include/g++/stl_algobase.h" 2 3 # 1 "/usr/include/g++/stl_relops.h" 1 3 template inline bool operator!=(const _Tp& __x, const _Tp& __y) { return !(__x == __y); } template inline bool operator>(const _Tp& __x, const _Tp& __y) { return __y < __x; } template inline bool operator<=(const _Tp& __x, const _Tp& __y) { return !(__y < __x); } template inline bool operator>=(const _Tp& __x, const _Tp& __y) { return !(__x < __y); } # 39 "/usr/include/g++/stl_algobase.h" 2 3 # 1 "/usr/include/g++/stl_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<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} }; template inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return __x.first == __y.first && __x.second == __y.second; } template inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second); } template inline pair<_T1, _T2> make_pair(const _T1& __x, const _T2& __y) { return pair<_T1, _T2>(__x, __y); } # 42 "/usr/include/g++/stl_algobase.h" 2 3 # 1 "/usr/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; }; 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; }; 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; }; 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; }; 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; }; 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; }; 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; }; 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; }; 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; }; 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; }; 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; }; 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; }; 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; }; 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; }; 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; }; 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; }; 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; }; template struct __type_traits<_Tp*> { typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_destructor; typedef __true_type is_POD_type; }; # 295 "/usr/include/g++/type_traits.h" 3 template struct _Is_integer { typedef __false_type _Integral; }; template<> struct _Is_integer { typedef __true_type _Integral; }; template<> struct _Is_integer { typedef __true_type _Integral; }; template<> struct _Is_integer { typedef __true_type _Integral; }; template<> struct _Is_integer { typedef __true_type _Integral; }; template<> struct _Is_integer { typedef __true_type _Integral; }; template<> struct _Is_integer { typedef __true_type _Integral; }; template<> struct _Is_integer { typedef __true_type _Integral; }; template<> struct _Is_integer { typedef __true_type _Integral; }; template<> struct _Is_integer { typedef __true_type _Integral; }; template<> struct _Is_integer { typedef __true_type _Integral; }; template<> struct _Is_integer { typedef __true_type _Integral; }; template<> struct _Is_integer { typedef __true_type _Integral; }; template<> struct _Is_integer { typedef __true_type _Integral; }; # 45 "/usr/include/g++/stl_algobase.h" 2 3 # 1 "/usr/include/string.h" 1 3 # 1 "/usr/include/sys/cdefs.h" 1 3 # 106 "/usr/include/sys/cdefs.h" 3 # 175 "/usr/include/sys/cdefs.h" 3 # 192 "/usr/include/sys/cdefs.h" 3 # 49 "/usr/include/string.h" 2 3 extern "C" { void *memchr (const void *, int, size_t) ; int memcmp (const void *, const void *, size_t) ; void *memcpy (void *, const void *, size_t) ; void *memmove (void *, const void *, size_t) ; void *memset (void *, int, size_t) ; char *strcat (char *, const char *) ; char *strchr (const char *, int) ; int strcmp (const char *, const char *) ; int strcoll (const char *, const char *) ; char *strcpy (char *, const char *) ; size_t strcspn (const char *, const char *) ; char *strerror (int) ; size_t strlen (const char *) ; char *strncat (char *, const char *, size_t) ; int strncmp (const char *, const char *, size_t) ; char *strncpy (char *, const char *, size_t) ; char *strpbrk (const char *, const char *) ; char *strrchr (const char *, int) ; size_t strspn (const char *, const char *) ; char *strstr (const char *, const char *) ; char *strtok (char *, const char *) ; size_t strxfrm (char *, const char *, size_t) ; int bcmp (const void *, const void *, size_t) ; void bcopy (const void *, void *, size_t) ; void bzero (void *, size_t) ; int ffs (int) ; char *index (const char *, int) ; void *memccpy (void *, const void *, int, size_t) ; char *rindex (const char *, int) ; int strcasecmp (const char *, const char *) ; char *strdup (const char *) ; size_t strlcat (char *, const char *, size_t) ; size_t strlcpy (char *, const char *, size_t) ; void strmode (int, char *) ; int strncasecmp (const char *, const char *, size_t) ; char *strsep (char **, const char *) ; char *strsignal (int) ; char *strtok_r (char *, const char *, char **) ; void swab (const void *, void *, size_t) ; } # 48 "/usr/include/g++/stl_algobase.h" 2 3 # 1 "/usr/include/limits.h" 1 3 # 1 "/usr/include/sys/_posix.h" 1 3 # 70 "/usr/include/sys/_posix.h" 3 # 39 "/usr/include/limits.h" 2 3 # 1 "/usr/include/machine/limits.h" 1 3 # 94 "/usr/include/limits.h" 2 3 # 1 "/usr/include/sys/syslimits.h" 1 3 # 96 "/usr/include/limits.h" 2 3 # 49 "/usr/include/g++/stl_algobase.h" 2 3 # 1 "/usr/include/stdlib.h" 1 3 typedef struct { int quot; int rem; } div_t; typedef struct { long quot; long rem; } ldiv_t; extern int __mb_cur_max; extern "C" { void abort (void) __attribute__((__noreturn__)) ; int abs (int) __attribute__((__const__)) ; int atexit (void (*)(void)) ; double atof (const char *) ; int atoi (const char *) ; long atol (const char *) ; void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *)) ; void *calloc (size_t, size_t) ; div_t div (int, int) __attribute__((__const__)) ; void exit (int) __attribute__((__noreturn__)) ; void free (void *) ; char *getenv (const char *) ; long labs (long) __attribute__((__const__)) ; ldiv_t ldiv (long, long) __attribute__((__const__)) ; void *malloc (size_t) ; void qsort (void *, size_t, size_t, int (*)(const void *, const void *)) ; int rand (void) ; void *realloc (void *, size_t) ; void srand (unsigned) ; double strtod (const char *, char **) ; long strtol (const char *, char **, int) ; unsigned long strtoul (const char *, char **, int) ; int system (const char *) ; int mblen (const char *, size_t) ; size_t mbstowcs (wchar_t *, const char *, size_t) ; int wctomb (char *, wchar_t) ; int mbtowc (wchar_t *, const char *, size_t) ; size_t wcstombs (char *, const wchar_t *, size_t) ; int putenv (const char *) ; int setenv (const char *, const char *, int) ; double drand48 (void) ; double erand48 (unsigned short[3]) ; long jrand48 (unsigned short[3]) ; void lcong48 (unsigned short[7]) ; long lrand48 (void) ; long mrand48 (void) ; long nrand48 (unsigned short[3]) ; unsigned short *seed48 (unsigned short[3]) ; void srand48 (long) ; void *alloca (size_t) ; __uint32_t arc4random (void) ; void arc4random_addrandom (unsigned char *dat, int datlen) ; void arc4random_stir (void) ; char *getbsize (int *, long *) ; char *cgetcap (char *, char *, int) ; int cgetclose (void) ; int cgetent (char **, char **, char *) ; int cgetfirst (char **, char **) ; int cgetmatch (char *, char *) ; int cgetnext (char **, char **) ; int cgetnum (char *, char *, long *) ; int cgetset (char *) ; int cgetstr (char *, char *, char **) ; int cgetustr (char *, char *, char **) ; int daemon (int, int) ; char *devname (int, int) ; int getloadavg (double [], int) ; char *group_from_gid (unsigned long, int) ; int heapsort (void *, size_t, size_t, int (*)(const void *, const void *)) ; char *initstate (unsigned long, char *, long) ; int mergesort (void *, size_t, size_t, int (*)(const void *, const void *)) ; int radixsort (const unsigned char **, int, const unsigned char *, unsigned) ; int sradixsort (const unsigned char **, int, const unsigned char *, unsigned) ; int rand_r (unsigned *) ; long random (void) ; void *reallocf (void *, size_t) ; char *realpath (const char *, char resolved_path[]) ; char *setstate (char *) ; void srandom (unsigned long) ; void srandomdev (void) ; char *user_from_uid (unsigned long, int) ; __int64_t strtoq (const char *, char **, int) ; __uint64_t strtouq (const char *, char **, int) ; void unsetenv (const char *) ; } # 50 "/usr/include/g++/stl_algobase.h" 2 3 # 1 "/usr/include/g++/new.h" 1 3 # 1 "/usr/include/g++/new" 1 3 #pragma interface "new" # 1 "/usr/include/g++/exception" 1 3 #pragma interface "exception" extern "C++" { namespace std { class exception { public: exception () { } virtual ~exception () { } virtual const char* what () const; }; class bad_exception : public exception { public: bad_exception () { } virtual ~bad_exception () { } }; typedef void (*terminate_handler) (); typedef void (*unexpected_handler) (); terminate_handler set_terminate (terminate_handler); void terminate () __attribute__ ((__noreturn__)); unexpected_handler set_unexpected (unexpected_handler); void unexpected () __attribute__ ((__noreturn__)); bool uncaught_exception (); } } # 9 "/usr/include/g++/new" 2 3 extern "C++" { namespace std { class bad_alloc : public exception { public: virtual const char* what() const throw() { return "bad_alloc"; } }; struct nothrow_t {}; extern const nothrow_t nothrow; typedef void (*new_handler)(); new_handler set_new_handler (new_handler); } void *operator new (size_t) throw (std::bad_alloc); void *operator new[] (size_t) throw (std::bad_alloc); void operator delete (void *) throw(); void operator delete[] (void *) throw(); void *operator new (size_t, const std::nothrow_t&) throw(); void *operator new[] (size_t, const std::nothrow_t&) throw(); void operator delete (void *, const std::nothrow_t&) throw(); void operator delete[] (void *, const std::nothrow_t&) throw(); inline void *operator new(size_t, void *place) throw() { return place; } inline void *operator new[](size_t, void *place) throw() { return place; } } # 6 "/usr/include/g++/new.h" 2 3 using std::new_handler; using std::set_new_handler; # 52 "/usr/include/g++/stl_algobase.h" 2 3 # 1 "/usr/include/g++/iostream.h" 1 3 #pragma interface # 1 "/usr/include/g++/streambuf.h" 1 3 #pragma interface extern "C" { # 1 "/usr/include/g++/libio.h" 1 3 # 55 "/usr/include/g++/libio.h" 3 # 67 "/usr/include/g++/libio.h" 3 # 104 "/usr/include/g++/libio.h" 3 struct _IO_jump_t; struct _IO_FILE; # 174 "/usr/include/g++/libio.h" 3 typedef void _IO_lock_t; struct _IO_marker { struct _IO_marker *_next; struct _IO_FILE *_sbuf; int _pos; # 207 "/usr/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]; }; 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/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; }; # 124 "/usr/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 _G_ssize_t streamsize; enum io_state { goodbit = 0 , eofbit = 1 , failbit = 2 , badbit = 4 }; enum open_mode { in = 1 , out = 2 , ate = 4 , app = 8 , trunc = 16 , nocreate = 32 , noreplace = 64 , bin = 128 , binary = 128 }; enum seek_dir { beg, cur, end}; typedef enum seek_dir seekdir; enum { skipws= 01 , left= 02 , right= 04 , internal= 010 , dec= 020 , oct= 040 , hex= 0100 , showbase= 0200 , showpoint= 0400 , uppercase= 01000 , showpos= 02000 , scientific= 04000 , fixed= 010000 , unitbuf= 020000 , stdio= 040000 }; enum { basefield=dec+oct+hex, floatfield = scientific+fixed, adjustfield = left+right+internal }; # 177 "/usr/include/g++/streambuf.h" 3 ostream* tie() const { return _tie; } ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; } short fill() const { return _fill; } short fill(short newf) {short oldf = _fill; _fill = newf; return oldf;} fmtflags flags() const { return _flags; } fmtflags flags(fmtflags new_val) { fmtflags old_val = _flags; _flags = new_val; return old_val; } int precision() const { return _precision; } int precision(int newp) { unsigned short oldp = _precision; _precision = (unsigned short)newp; return oldp; } fmtflags setf(fmtflags val) { fmtflags oldbits = _flags; _flags |= val; return oldbits; } fmtflags setf(fmtflags val, fmtflags mask) { fmtflags oldbits = _flags; _flags = (_flags & ~mask) | (val & mask); return oldbits; } fmtflags unsetf(fmtflags mask) { fmtflags oldbits = _flags; _flags &= ~mask; return oldbits; } int width() const { return _width; } int width(int val) { int save = _width; _width = val; return save; } void _throw_failure() const { } void clear(iostate state = 0) { _state = _strbuf ? state : state|badbit; if (_state & _exceptions) _throw_failure(); } void set(iostate flag) { _state |= flag; if (_state & _exceptions) _throw_failure(); } void setstate(iostate flag) { _state |= flag; if (_state & _exceptions) _throw_failure(); } int good() const { return _state == 0; } int eof() const { return _state & ios::eofbit; } int fail() const { return _state & (ios::badbit|ios::failbit); } int bad() const { return _state & ios::badbit; } iostate rdstate() const { return _state; } operator void*() const { return fail() ? (void*)0 : (void*)(-1); } int operator!() const { return fail(); } iostate exceptions() const { return _exceptions; } void exceptions(iostate enable) { _exceptions = enable; if (_state & _exceptions) _throw_failure(); } streambuf* rdbuf() const { return _strbuf; } streambuf* rdbuf(streambuf *_s) { streambuf *_old = _strbuf; _strbuf = _s; clear (); return _old; } static int sync_with_stdio(int on); static void sync_with_stdio() { sync_with_stdio(1); } static fmtflags bitalloc(); static int xalloc(); void*& pword(int); void* pword(int) const; long& iword(int); long iword(int) const; class Init { public: Init () { } }; protected: inline ios(streambuf* sb = 0, ostream* tie_to = 0); inline virtual ~ios(); inline void init(streambuf* sb, ostream* tie = 0); }; typedef ios::seek_dir _seek_dir; class streammarker : private _IO_marker { friend class streambuf; void set_offset(int offset) { _pos = offset; } public: streammarker(streambuf *sb); ~streammarker(); int saving() { return 1; } int delta(streammarker&); int delta(); }; struct streambuf : public _IO_FILE { friend class ios; friend class istream; friend class ostream; friend class streammarker; const void *&_vtable() { return *(const void**)((_IO_FILE*)this + 1); } protected: static streambuf* _list_all; _IO_FILE*& xchain() { return _chain; } void _un_link(); void _link_in(); char* gptr() const { return _flags & 0x100 ? _IO_save_base : _IO_read_ptr; } char* pptr() const { return _IO_write_ptr; } char* egptr() const { return _flags & 0x100 ? _IO_save_end : _IO_read_end; } char* epptr() const { return _IO_write_end; } char* pbase() const { return _IO_write_base; } char* eback() const { return _flags & 0x100 ? _IO_save_base : _IO_read_base;} char* base() const { return _IO_buf_base; } char* ebuf() const { return _IO_buf_end; } int blen() const { return _IO_buf_end - _IO_buf_base; } void xput_char(char c) { *_IO_write_ptr++ = c; } int xflags() { return _flags ; } int xflags(int f) {int fl = _flags ; _flags = f; return fl;} void xsetflags(int f) { _flags |= f; } void xsetflags(int f, int mask) { _flags = (_flags & ~mask) | (f & mask); } void gbump(int n) { _flags & 0x100 ? (_IO_save_base+=n):(_IO_read_ptr+=n);} void pbump(int n) { _IO_write_ptr += n; } void setb(char* b, char* eb, int a=0); void setp(char* p, char* ep) { _IO_write_base=_IO_write_ptr=p; _IO_write_end=ep; } void setg(char* eb, char* g, char *eg) { if (_flags & 0x100 ) _IO_free_backup_area(this); _IO_read_base = eb; _IO_read_ptr = g; _IO_read_end = eg; } char *shortbuf() { return _shortbuf; } int in_backup() { return _flags & 0x100 ; } char *Gbase() { return in_backup() ? _IO_save_base : _IO_read_base; } char *eGptr() { return in_backup() ? _IO_save_end : _IO_read_end; } char *Bbase() { return in_backup() ? _IO_read_base : _IO_save_base; } char *Bptr() { return _IO_backup_base; } char *eBptr() { return in_backup() ? _IO_read_end : _IO_save_end; } char *Nbase() { return _IO_save_base; } char *eNptr() { return _IO_save_end; } int have_backup() { return _IO_save_base != 0 ; } int have_markers() { return _markers != 0 ; } 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() == 0 ) doallocbuf(); } void doallocbuf(); int in_avail() { return _IO_read_end - _IO_read_ptr; } int out_waiting() { return _IO_write_ptr - _IO_write_base; } streamsize sputn(const char* s, streamsize n) { return xsputn(s, n); } streamsize padn(char pad, streamsize n) { return _IO_padn(this, pad, n); } streamsize sgetn(char* s, streamsize n) { return _IO_sgetn(this, s, n); } int ignore(int); int get_column(); int set_column(int); long sgetline(char* buf, _G_size_t n, char delim, int putback_delim); int sputc(int c) { return _IO_putc(c, this); } int sbumpc() { return _IO_getc(this); } int sgetc() { return (( this )->_IO_read_ptr >= ( this )->_IO_read_end && __underflow ( this ) == (-1) ? (-1) : *(unsigned char *) ( this )->_IO_read_ptr) ; } int snextc() { if (_IO_read_ptr >= _IO_read_end && __underflow(this) == (-1) ) return (-1) ; else return _IO_read_ptr++, sgetc(); } void stossc() { if (_IO_read_ptr < _IO_read_end) _IO_read_ptr++; } int vscan(char const *fmt0, _G_va_list ap, ios* stream = 0 ); int scan(char const *fmt0 ...); int vform(char const *fmt0, _G_va_list ap); int form(char const *fmt0 ...); virtual streamsize sys_read(char* buf, streamsize size); virtual streamsize sys_write(const char*, streamsize); virtual streampos sys_seek(streamoff, _seek_dir); virtual int sys_close(); virtual int sys_stat(void*); }; class filebuf : public streambuf { protected: void init(); public: static const int openprot; filebuf(); filebuf(int fd); filebuf(int fd, char* p, int len); ~filebuf(); filebuf* attach(int fd); filebuf* open(const char *filename, const char *mode); filebuf* open(const char *filename, ios::openmode mode, int prot = 0664); virtual int underflow(); virtual int overflow(int c = (-1) ); int is_open() const { return _fileno >= 0; } int fd() const { return is_open() ? _fileno : (-1) ; } filebuf* close(); virtual int doallocate(); virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); virtual streambuf* setbuf(char* p, int len); streamsize xsputn(const char* s, streamsize n); streamsize xsgetn(char* s, streamsize n); virtual int sync(); protected: int is_reading() { return eback() != egptr(); } char* cur_ptr() { return is_reading() ? gptr() : pptr(); } char* file_ptr() { return eGptr(); } virtual streamsize sys_read(char* buf, streamsize size); virtual streampos sys_seek(streamoff, _seek_dir); virtual streamsize sys_write(const char*, streamsize); virtual int sys_stat(void*); virtual int sys_close(); }; inline void ios::init(streambuf* sb, ostream* tie_to) { _state = sb ? ios::goodbit : ios::badbit; _exceptions=0; _strbuf=sb; _tie = tie_to; _width=0; _fill=' '; _flags=ios::skipws|ios::dec; _precision=6; _arrays = 0; } inline ios::ios(streambuf* sb, ostream* tie_to) { init(sb, tie_to); } inline ios::~ios() { operator delete[] (_arrays); } } # 31 "/usr/include/g++/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= 0 ); int opfx() { if (!good()) return 0; else { if (_tie) _tie->flush(); ; return 1;} } void osfx() { ; if (flags() & (ios::unitbuf|ios::stdio)) do_osfx(); } ostream& flush(); ostream& put(char c) { _strbuf->sputc(c); return *this; } ostream& write(const char *s, streamsize n); ostream& write(const unsigned char *s, streamsize n) { return write((const char*)s, n);} ostream& write(const signed char *s, streamsize n) { return write((const char*)s, n);} ostream& write(const void *s, streamsize n) { return write((const char*)s, n);} ostream& seekp(streampos); ostream& seekp(streamoff, _seek_dir); streampos tellp(); ostream& form(const char *format ...); ostream& vform(const char *format, _G_va_list args); ostream& operator<<(char c); ostream& operator<<(unsigned char c) { return (*this) << (char)c; } ostream& operator<<(signed char c) { return (*this) << (char)c; } ostream& operator<<(const char *s); ostream& operator<<(const unsigned char *s) { return (*this) << (const char*)s; } ostream& operator<<(const signed char *s) { return (*this) << (const char*)s; } ostream& operator<<(const void *p); ostream& operator<<(int n); ostream& operator<<(unsigned int n); ostream& operator<<(long n); ostream& operator<<(unsigned long n); __extension__ ostream& operator<<(long long n); __extension__ ostream& operator<<(unsigned long long n); ostream& operator<<(short n) {return operator<<((int)n);} ostream& operator<<(unsigned short n) {return operator<<((unsigned int)n);} ostream& operator<<(bool b) { return operator<<((int)b); } ostream& operator<<(double n); ostream& operator<<(float n) { return operator<<((double)n); } ostream& operator<<(long double n) { return operator<<((double)n); } ostream& operator<<(__omanip func) { return (*func)(*this); } ostream& operator<<(__manip func) {(*func)(*this); return *this;} ostream& operator<<(streambuf*); }; class istream : virtual public ios { protected: _G_size_t _gcount; int _skip_ws(); public: istream(): _gcount (0) { } istream(streambuf* sb, ostream*tied= 0 ); istream& get(char* ptr, int len, char delim = '\n'); istream& get(unsigned char* ptr, int len, char delim = '\n') { return get((char*)ptr, len, delim); } istream& get(char& c); istream& get(unsigned char& c) { return get((char&)c); } istream& getline(char* ptr, int len, char delim = '\n'); istream& getline(unsigned char* ptr, int len, char delim = '\n') { return getline((char*)ptr, len, delim); } istream& get(signed char& c) { return get((char&)c); } istream& get(signed char* ptr, int len, char delim = '\n') { return get((char*)ptr, len, delim); } istream& getline(signed char* ptr, int len, char delim = '\n') { return getline((char*)ptr, len, delim); } istream& read(char *ptr, streamsize n); istream& read(unsigned char *ptr, streamsize n) { return read((char*)ptr, n); } istream& read(signed char *ptr, streamsize n) { return read((char*)ptr, n); } istream& read(void *ptr, streamsize n) { return read((char*)ptr, n); } istream& get(streambuf& sb, char delim = '\n'); istream& gets(char **s, char delim = '\n'); int ipfx(int need = 0) { if (!good()) { set(ios::failbit); return 0; } else { ; if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush(); if (!need && (flags() & ios::skipws)) return _skip_ws(); else return 1; } } int ipfx0() { if (!good()) { set(ios::failbit); return 0; } else { ; if (_tie) _tie->flush(); if (flags() & ios::skipws) return _skip_ws(); else return 1; } } int ipfx1() { if (!good()) { set(ios::failbit); return 0; } else { ; if (_tie && rdbuf()->in_avail() == 0) _tie->flush(); return 1; } } void isfx() { ; } int get() { if (!ipfx1()) return (-1) ; else { int ch = _strbuf->sbumpc(); if (ch == (-1) ) set(ios::eofbit); isfx(); return ch; } } int peek(); _G_size_t gcount() { return _gcount; } istream& ignore(int n=1, int delim = (-1) ); int sync (); istream& seekg(streampos); istream& seekg(streamoff, _seek_dir); streampos tellg(); istream& putback(char ch) { if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit); return *this;} istream& unget() { if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit); return *this;} istream& scan(const char *format ...); istream& vscan(const char *format, _G_va_list args); istream& operator>>(char*); istream& operator>>(unsigned char* p) { return operator>>((char*)p); } istream& operator>>(signed char*p) { return operator>>((char*)p); } istream& operator>>(char& c); istream& operator>>(unsigned char& c) {return operator>>((char&)c);} istream& operator>>(signed char& c) {return operator>>((char&)c);} istream& operator>>(int&); istream& operator>>(long&); __extension__ istream& operator>>(long long&); __extension__ istream& operator>>(unsigned long long&); istream& operator>>(short&); istream& operator>>(unsigned int&); istream& operator>>(unsigned long&); istream& operator>>(unsigned short&); istream& operator>>(bool&); istream& operator>>(float&); istream& operator>>(double&); istream& operator>>(long double&); istream& operator>>( __manip func) {(*func)(*this); return *this;} istream& operator>>(__imanip func) { return (*func)(*this); } istream& operator>>(streambuf*); }; class iostream : public istream, public ostream { public: iostream() { } iostream(streambuf* sb, ostream*tied= 0 ); }; 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; } } # 53 "/usr/include/g++/stl_algobase.h" 2 3 # 1 "/usr/include/g++/stl_iterator.h" 1 3 struct input_iterator_tag {}; struct output_iterator_tag {}; struct forward_iterator_tag : public input_iterator_tag {}; struct bidirectional_iterator_tag : public forward_iterator_tag {}; struct random_access_iterator_tag : public bidirectional_iterator_tag {}; template struct input_iterator { typedef input_iterator_tag iterator_category; typedef _Tp value_type; typedef _Distance difference_type; typedef _Tp* pointer; typedef _Tp& reference; }; struct output_iterator { typedef output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; typedef void reference; }; template struct forward_iterator { typedef forward_iterator_tag iterator_category; typedef _Tp value_type; typedef _Distance difference_type; typedef _Tp* pointer; typedef _Tp& reference; }; template struct bidirectional_iterator { typedef bidirectional_iterator_tag iterator_category; typedef _Tp value_type; typedef _Distance difference_type; typedef _Tp* pointer; typedef _Tp& reference; }; template struct random_access_iterator { typedef random_access_iterator_tag iterator_category; typedef _Tp value_type; typedef _Distance difference_type; typedef _Tp* pointer; typedef _Tp& reference; }; # 98 "/usr/include/g++/stl_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<_Tp*> { typedef random_access_iterator_tag iterator_category; typedef _Tp value_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef _Tp& reference; }; template struct iterator_traits { typedef random_access_iterator_tag iterator_category; typedef _Tp value_type; typedef ptrdiff_t difference_type; typedef const _Tp* pointer; typedef const _Tp& reference; }; template inline typename iterator_traits<_Iter>::iterator_category __iterator_category(const _Iter&) { typedef typename iterator_traits<_Iter>::iterator_category _Category; return _Category(); } template inline typename iterator_traits<_Iter>::difference_type* __distance_type(const _Iter&) { return static_cast::difference_type*>(0); } template inline typename iterator_traits<_Iter>::value_type* __value_type(const _Iter&) { return static_cast::value_type*>(0); } template inline typename iterator_traits<_Iter>::iterator_category iterator_category(const _Iter& __i) { return __iterator_category(__i); } template inline typename iterator_traits<_Iter>::difference_type* distance_type(const _Iter& __i) { return __distance_type(__i); } template inline typename iterator_traits<_Iter>::value_type* value_type(const _Iter& __i) { return __value_type(__i); } # 259 "/usr/include/g++/stl_iterator.h" 3 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 typename iterator_traits<_InputIterator>::difference_type __distance(_InputIterator __first, _InputIterator __last, input_iterator_tag) { typename iterator_traits<_InputIterator>::difference_type __n = 0; while (__first != __last) { ++__first; ++__n; } return __n; } template inline typename iterator_traits<_RandomAccessIterator>::difference_type __distance(_RandomAccessIterator __first, _RandomAccessIterator __last, random_access_iterator_tag) { return __last - __first; } template inline typename iterator_traits<_InputIterator>::difference_type distance(_InputIterator __first, _InputIterator __last) { typedef typename iterator_traits<_InputIterator>::iterator_category _Category; return __distance(__first, __last, _Category()); } template inline void __advance(_InputIter& __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 class back_insert_iterator { protected: _Container* container; public: typedef _Container container_type; typedef output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; typedef void reference; explicit back_insert_iterator(_Container& __x) : container(&__x) {} back_insert_iterator<_Container>& operator=(const typename _Container::value_type& __value) { container->push_back(__value); return *this; } back_insert_iterator<_Container>& operator*() { return *this; } back_insert_iterator<_Container>& operator++() { return *this; } back_insert_iterator<_Container>& operator++(int) { return *this; } }; # 378 "/usr/include/g++/stl_iterator.h" 3 template inline back_insert_iterator<_Container> back_inserter(_Container& __x) { return back_insert_iterator<_Container>(__x); } template class front_insert_iterator { protected: _Container* container; public: typedef _Container container_type; typedef output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; typedef void reference; explicit front_insert_iterator(_Container& __x) : container(&__x) {} front_insert_iterator<_Container>& operator=(const typename _Container::value_type& __value) { container->push_front(__value); return *this; } front_insert_iterator<_Container>& operator*() { return *this; } front_insert_iterator<_Container>& operator++() { return *this; } front_insert_iterator<_Container>& operator++(int) { return *this; } }; # 417 "/usr/include/g++/stl_iterator.h" 3 template inline front_insert_iterator<_Container> front_inserter(_Container& __x) { return front_insert_iterator<_Container>(__x); } template class insert_iterator { protected: _Container* container; typename _Container::iterator iter; public: typedef _Container container_type; typedef output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; typedef void reference; insert_iterator(_Container& __x, typename _Container::iterator __i) : container(&__x), iter(__i) {} insert_iterator<_Container>& operator=(const typename _Container::value_type& __value) { iter = container->insert(iter, __value); ++iter; return *this; } insert_iterator<_Container>& operator*() { return *this; } insert_iterator<_Container>& operator++() { return *this; } insert_iterator<_Container>& operator++(int) { return *this; } }; # 459 "/usr/include/g++/stl_iterator.h" 3 template inline insert_iterator<_Container> inserter(_Container& __x, _Iterator __i) { typedef typename _Container::iterator __iter; return insert_iterator<_Container>(__x, __iter(__i)); } template class reverse_bidirectional_iterator { typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, _Reference, _Distance> _Self; protected: _BidirectionalIterator current; public: typedef bidirectional_iterator_tag iterator_category; typedef _Tp value_type; typedef _Distance difference_type; typedef _Tp* pointer; typedef _Reference reference; reverse_bidirectional_iterator() {} explicit reverse_bidirectional_iterator(_BidirectionalIterator __x) : current(__x) {} _BidirectionalIterator base() const { return current; } _Reference operator*() const { _BidirectionalIterator __tmp = current; return *--__tmp; } pointer operator->() const { return &(operator*()); } _Self& operator++() { --current; return *this; } _Self operator++(int) { _Self __tmp = *this; --current; return __tmp; } _Self& operator--() { ++current; return *this; } _Self operator--(int) { _Self __tmp = *this; ++current; return __tmp; } }; # 550 "/usr/include/g++/stl_iterator.h" 3 template inline bool operator==( const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __x, const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __y) { return __x.base() == __y.base(); } template class reverse_iterator { protected: _Iterator current; public: typedef typename iterator_traits<_Iterator>::iterator_category iterator_category; typedef typename iterator_traits<_Iterator>::value_type value_type; typedef typename iterator_traits<_Iterator>::difference_type difference_type; typedef typename iterator_traits<_Iterator>::pointer pointer; typedef typename iterator_traits<_Iterator>::reference reference; typedef _Iterator iterator_type; typedef reverse_iterator<_Iterator> _Self; public: reverse_iterator() {} explicit reverse_iterator(iterator_type __x) : current(__x) {} reverse_iterator(const _Self& __x) : current(__x.current) {} template reverse_iterator(const reverse_iterator<_Iter>& __x) : current(__x.base()) {} iterator_type base() const { return current; } reference operator*() const { _Iterator __tmp = current; return *--__tmp; } pointer operator->() const { return &(operator*()); } _Self& operator++() { --current; return *this; } _Self operator++(int) { _Self __tmp = *this; --current; return __tmp; } _Self& operator--() { ++current; return *this; } _Self operator--(int) { _Self __tmp = *this; ++current; return __tmp; } _Self operator+(difference_type __n) const { return _Self(current - __n); } _Self& operator+=(difference_type __n) { current -= __n; return *this; } _Self operator-(difference_type __n) const { return _Self(current + __n); } _Self& operator-=(difference_type __n) { current += __n; return *this; } reference operator[](difference_type __n) const { return *(*this + __n); } }; template inline bool operator==(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return __x.base() == __y.base(); } template inline bool operator<(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return __y.base() < __x.base(); } template inline typename reverse_iterator<_Iterator>::difference_type operator-(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return __y.base() - __x.base(); } template inline reverse_iterator<_Iterator> operator+(typename reverse_iterator<_Iterator>::difference_type __n, const reverse_iterator<_Iterator>& __x) { return reverse_iterator<_Iterator>(__x.base() - __n); } # 805 "/usr/include/g++/stl_iterator.h" 3 template class istream_iterator { friend bool operator== <> (const istream_iterator&, const istream_iterator&); protected: istream* _M_stream; _Tp _M_value; bool _M_end_marker; void _M_read() { _M_end_marker = (*_M_stream) ? true : false; if (_M_end_marker) *_M_stream >> _M_value; _M_end_marker = (*_M_stream) ? true : false; } public: typedef input_iterator_tag iterator_category; typedef _Tp value_type; typedef _Dist difference_type; typedef const _Tp* pointer; typedef const _Tp& reference; istream_iterator() : _M_stream(&cin), _M_end_marker(false) {} istream_iterator(istream& __s) : _M_stream(&__s) { _M_read(); } reference operator*() const { return _M_value; } pointer operator->() const { return &(operator*()); } istream_iterator<_Tp, _Dist>& operator++() { _M_read(); return *this; } istream_iterator<_Tp, _Dist> operator++(int) { istream_iterator<_Tp, _Dist> __tmp = *this; _M_read(); return __tmp; } }; # 864 "/usr/include/g++/stl_iterator.h" 3 template inline bool operator==(const istream_iterator<_Tp, _Distance>& __x, const istream_iterator<_Tp, _Distance>& __y) { return (__x._M_stream == __y._M_stream && __x._M_end_marker == __y._M_end_marker) || __x._M_end_marker == false && __y._M_end_marker == false; } template class ostream_iterator { protected: ostream* _M_stream; const char* _M_string; public: typedef output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; typedef void reference; ostream_iterator(ostream& __s) : _M_stream(&__s), _M_string(0) {} ostream_iterator(ostream& __s, const char* __c) : _M_stream(&__s), _M_string(__c) {} ostream_iterator<_Tp>& operator=(const _Tp& __value) { *_M_stream << __value; if (_M_string) *_M_stream << _M_string; return *this; } ostream_iterator<_Tp>& operator*() { return *this; } ostream_iterator<_Tp>& operator++() { return *this; } ostream_iterator<_Tp>& operator++(int) { return *this; } }; # 907 "/usr/include/g++/stl_iterator.h" 3 # 56 "/usr/include/g++/stl_algobase.h" 2 3 template inline void __iter_swap(_ForwardIter1 __a, _ForwardIter2 __b, _Tp*) { _Tp __tmp = *__a; *__a = *__b; *__b = __tmp; } template inline void iter_swap(_ForwardIter1 __a, _ForwardIter2 __b) { __iter_swap(__a, __b, __value_type( __a ) ); } template inline void swap(_Tp& __a, _Tp& __b) { _Tp __tmp = __a; __a = __b; __b = __tmp; } template inline const _Tp& min(const _Tp& __a, const _Tp& __b) { return __b < __a ? __b : __a; } template inline const _Tp& max(const _Tp& __a, const _Tp& __b) { return __a < __b ? __b : __a; } template inline const _Tp& min(const _Tp& __a, const _Tp& __b, _Compare __comp) { return __comp(__b, __a) ? __b : __a; } template inline const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) { return __comp(__a, __b) ? __b : __a; } template inline _OutputIter __copy(_InputIter __first, _InputIter __last, _OutputIter __result, input_iterator_tag, _Distance*) { for ( ; __first != __last; ++__result, ++__first) *__result = *__first; return __result; } template inline _OutputIter __copy(_RandomAccessIter __first, _RandomAccessIter __last, _OutputIter __result, random_access_iterator_tag, _Distance*) { for (_Distance __n = __last - __first; __n > 0; --__n) { *__result = *__first; ++__first; ++__result; } return __result; } template inline _Tp* __copy_trivial(const _Tp* __first, const _Tp* __last, _Tp* __result) { memmove(__result, __first, sizeof(_Tp) * (__last - __first)); return __result + (__last - __first); } template struct __copy_dispatch { static _OutputIter copy(_InputIter __first, _InputIter __last, _OutputIter __result) { typedef typename iterator_traits<_InputIter>::iterator_category _Category; typedef typename iterator_traits<_InputIter>::difference_type _Distance; return __copy(__first, __last, __result, _Category(), (_Distance*) 0); } }; template struct __copy_dispatch<_Tp*, _Tp*, __true_type> { static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) { return __copy_trivial(__first, __last, __result); } }; template struct __copy_dispatch { static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) { return __copy_trivial(__first, __last, __result); } }; template inline _OutputIter copy(_InputIter __first, _InputIter __last, _OutputIter __result) { typedef typename iterator_traits<_InputIter>::value_type _Tp; typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _Trivial; return __copy_dispatch<_InputIter, _OutputIter, _Trivial> ::copy(__first, __last, __result); } # 213 "/usr/include/g++/stl_algobase.h" 3 template inline _BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first, _BidirectionalIter1 __last, _BidirectionalIter2 __result, bidirectional_iterator_tag, _Distance*) { while (__first != __last) *--__result = *--__last; return __result; } template inline _BidirectionalIter __copy_backward(_RandomAccessIter __first, _RandomAccessIter __last, _BidirectionalIter __result, random_access_iterator_tag, _Distance*) { for (_Distance __n = __last - __first; __n > 0; --__n) *--__result = *--__last; return __result; } template struct __copy_backward_dispatch { typedef typename iterator_traits<_BidirectionalIter1>::iterator_category _Cat; typedef typename iterator_traits<_BidirectionalIter1>::difference_type _Distance; static _BidirectionalIter2 copy(_BidirectionalIter1 __first, _BidirectionalIter1 __last, _BidirectionalIter2 __result) { return __copy_backward(__first, __last, __result, _Cat(), (_Distance*) 0); } }; template struct __copy_backward_dispatch<_Tp*, _Tp*, __true_type> { static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) { const ptrdiff_t _Num = __last - __first; memmove(__result - _Num, __first, sizeof(_Tp) * _Num); return __result - _Num; } }; template struct __copy_backward_dispatch { static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) { return __copy_backward_dispatch<_Tp*, _Tp*, __true_type> ::copy(__first, __last, __result); } }; template inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) { typedef typename __type_traits::value_type> ::has_trivial_assignment_operator _Trivial; return __copy_backward_dispatch<_BI1, _BI2, _Trivial> ::copy(__first, __last, __result); } # 303 "/usr/include/g++/stl_algobase.h" 3 template pair<_InputIter, _OutputIter> __copy_n(_InputIter __first, _Size __count, _OutputIter __result, input_iterator_tag) { for ( ; __count > 0; --__count) { *__result = *__first; ++__first; ++__result; } return pair<_InputIter, _OutputIter>(__first, __result); } template inline pair<_RAIter, _OutputIter> __copy_n(_RAIter __first, _Size __count, _OutputIter __result, random_access_iterator_tag) { _RAIter __last = __first + __count; return pair<_RAIter, _OutputIter>(__last, copy(__first, __last, __result)); } template inline pair<_InputIter, _OutputIter> __copy_n(_InputIter __first, _Size __count, _OutputIter __result) { return __copy_n(__first, __count, __result, __iterator_category( __first ) ); } template inline pair<_InputIter, _OutputIter> copy_n(_InputIter __first, _Size __count, _OutputIter __result) { return __copy_n(__first, __count, __result); } template void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __value) { for ( ; __first != __last; ++__first) *__first = __value; } template _OutputIter fill_n(_OutputIter __first, _Size __n, const _Tp& __value) { for ( ; __n > 0; --__n, ++__first) *__first = __value; return __first; } template pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2) { while (__first1 != __last1 && *__first1 == *__first2) { ++__first1; ++__first2; } return pair<_InputIter1, _InputIter2>(__first1, __first2); } template pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _BinaryPredicate __binary_pred) { while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) { ++__first1; ++__first2; } return pair<_InputIter1, _InputIter2>(__first1, __first2); } template inline bool equal(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2) { for ( ; __first1 != __last1; ++__first1, ++__first2) if (*__first1 != *__first2) return false; return true; } template inline bool equal(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _BinaryPredicate __binary_pred) { for ( ; __first1 != __last1; ++__first1, ++__first2) if (!__binary_pred(*__first1, *__first2)) return false; return true; } template bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2) { for ( ; __first1 != __last1 && __first2 != __last2 ; ++__first1, ++__first2) { if (*__first1 < *__first2) return true; if (*__first2 < *__first1) return false; } return __first1 == __last1 && __first2 != __last2; } template bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) { for ( ; __first1 != __last1 && __first2 != __last2 ; ++__first1, ++__first2) { if (__comp(*__first1, *__first2)) return true; if (__comp(*__first2, *__first1)) return false; } return __first1 == __last1 && __first2 != __last2; } inline bool lexicographical_compare(const unsigned char* __first1, const unsigned char* __last1, const unsigned char* __first2, const unsigned char* __last2) { const size_t __len1 = __last1 - __first1; const size_t __len2 = __last2 - __first2; const int __result = memcmp(__first1, __first2, min(__len1, __len2)); return __result != 0 ? __result < 0 : __len1 < __len2; } inline bool lexicographical_compare(const char* __first1, const char* __last1, const char* __first2, const char* __last2) { return lexicographical_compare((const signed char*) __first1, (const signed char*) __last1, (const signed char*) __first2, (const signed char*) __last2); } template int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2) { while (__first1 != __last1 && __first2 != __last2) { if (*__first1 < *__first2) return -1; if (*__first2 < *__first1) return 1; ++__first1; ++__first2; } if (__first2 == __last2) { return !(__first1 == __last1); } else { return -1; } } inline int __lexicographical_compare_3way(const unsigned char* __first1, const unsigned char* __last1, const unsigned char* __first2, const unsigned char* __last2) { const ptrdiff_t __len1 = __last1 - __first1; const ptrdiff_t __len2 = __last2 - __first2; const int __result = memcmp(__first1, __first2, min(__len1, __len2)); return __result != 0 ? __result : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1)); } inline int __lexicographical_compare_3way(const char* __first1, const char* __last1, const char* __first2, const char* __last2) { return __lexicographical_compare_3way( (const signed char*) __first1, (const signed char*) __last1, (const signed char*) __first2, (const signed char*) __last2); } template int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2) { return __lexicographical_compare_3way(__first1, __last1, __first2, __last2); } # 30 "/usr/include/g++/vector" 2 3 # 1 "/usr/include/g++/stl_alloc.h" 1 3 # 1 "/usr/include/assert.h" 1 3 extern "C" { void __assert (const char *, int, const char *) ; } # 56 "/usr/include/g++/stl_alloc.h" 2 3 # 78 "/usr/include/g++/stl_alloc.h" 3 # 87 "/usr/include/g++/stl_alloc.h" 3 # 97 "/usr/include/g++/stl_alloc.h" 3 # 115 "/usr/include/g++/stl_alloc.h" 3 template class __malloc_alloc_template { private: static void* _S_oom_malloc(size_t); static void* _S_oom_realloc(void*, size_t); static void (* __malloc_alloc_oom_handler)(); public: static void* allocate(size_t __n) { void* __result = malloc(__n); if (0 == __result) __result = _S_oom_malloc(__n); return __result; } static void deallocate(void* __p, size_t ) { free(__p); } static void* reallocate(void* __p, size_t , size_t __new_sz) { void* __result = realloc(__p, __new_sz); if (0 == __result) __result = _S_oom_realloc(__p, __new_sz); return __result; } static void (* __set_malloc_handler(void (*__f)()))() { void (* __old)() = __malloc_alloc_oom_handler; __malloc_alloc_oom_handler = __f; return(__old); } }; template void (* __malloc_alloc_template<__inst>::__malloc_alloc_oom_handler)() = 0; template void* __malloc_alloc_template<__inst>::_S_oom_malloc(size_t __n) { void (* __my_malloc_handler)(); void* __result; for (;;) { __my_malloc_handler = __malloc_alloc_oom_handler; if (0 == __my_malloc_handler) { cerr << "out of memory" << endl; exit(1) ; } (*__my_malloc_handler)(); __result = malloc(__n); if (__result) return(__result); } } template void* __malloc_alloc_template<__inst>::_S_oom_realloc(void* __p, size_t __n) { void (* __my_malloc_handler)(); void* __result; for (;;) { __my_malloc_handler = __malloc_alloc_oom_handler; if (0 == __my_malloc_handler) { cerr << "out of memory" << endl; exit(1) ; } (*__my_malloc_handler)(); __result = realloc(__p, __n); if (__result) return(__result); } } typedef __malloc_alloc_template<0> malloc_alloc; template class simple_alloc { public: static _Tp* allocate(size_t __n) { return 0 == __n ? 0 : (_Tp*) _Alloc::allocate(__n * sizeof (_Tp)); } static _Tp* allocate(void) { return (_Tp*) _Alloc::allocate(sizeof (_Tp)); } static void deallocate(_Tp* __p, size_t __n) { if (0 != __n) _Alloc::deallocate(__p, __n * sizeof (_Tp)); } static void deallocate(_Tp* __p) { _Alloc::deallocate(__p, sizeof (_Tp)); } }; template class debug_alloc { private: enum {_S_extra = 8}; public: static void* allocate(size_t __n) { char* __result = (char*)_Alloc::allocate(__n + _S_extra); *(size_t*)__result = __n; return __result + _S_extra; } static void deallocate(void* __p, size_t __n) { char* __real_p = (char*)__p - _S_extra; (( *(size_t*)__real_p == __n ) ? (void)0 : __assert("/usr/include/g++/stl_alloc.h", 263, "*(size_t*)__real_p == __n")) ; _Alloc::deallocate(__real_p, __n + _S_extra); } static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz) { char* __real_p = (char*)__p - _S_extra; (( *(size_t*)__real_p == __old_sz ) ? (void)0 : __assert("/usr/include/g++/stl_alloc.h", 270, "*(size_t*)__real_p == __old_sz")) ; char* __result = (char*) _Alloc::reallocate(__real_p, __old_sz + _S_extra, __new_sz + _S_extra); *(size_t*)__result = __new_sz; return __result + _S_extra; } }; template class __default_alloc_template { private: enum {_ALIGN = 8}; enum {_MAX_BYTES = 128}; enum {_NFREELISTS = _MAX_BYTES/_ALIGN}; static size_t _S_round_up(size_t __bytes) { return (((__bytes) + _ALIGN-1) & ~(_ALIGN - 1)); } private : union _Obj { union _Obj* _M_free_list_link; char _M_client_data[1]; }; private: static _Obj* _S_free_list[_NFREELISTS]; static size_t _S_freelist_index(size_t __bytes) { return (((__bytes) + _ALIGN-1)/_ALIGN - 1); } static void* _S_refill(size_t __n); static char* _S_chunk_alloc(size_t __size, int& __nobjs); static char* _S_start_free; static char* _S_end_free; static size_t _S_heap_size; # 389 "/usr/include/g++/stl_alloc.h" 3 class _Lock { public: _Lock() { ; } ~_Lock() { ; } }; friend class _Lock; public: static void* allocate(size_t __n) { _Obj* * __my_free_list; _Obj* __result; if (__n > (size_t) _MAX_BYTES) { return(malloc_alloc::allocate(__n)); } __my_free_list = _S_free_list + _S_freelist_index(__n); __result = *__my_free_list; if (__result == 0) { void* __r = _S_refill(_S_round_up(__n)); return __r; } *__my_free_list = __result -> _M_free_list_link; return (__result); }; static void deallocate(void* __p, size_t __n) { _Obj* __q = (_Obj*)__p; _Obj* * __my_free_list; if (__n > (size_t) _MAX_BYTES) { malloc_alloc::deallocate(__p, __n); return; } __my_free_list = _S_free_list + _S_freelist_index(__n); __q -> _M_free_list_link = *__my_free_list; *__my_free_list = __q; } static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz); } ; typedef __default_alloc_template< false , 0> alloc; typedef __default_alloc_template single_client_alloc; template char* __default_alloc_template<__threads, __inst>::_S_chunk_alloc(size_t __size, int& __nobjs) { char* __result; size_t __total_bytes = __size * __nobjs; size_t __bytes_left = _S_end_free - _S_start_free; if (__bytes_left >= __total_bytes) { __result = _S_start_free; _S_start_free += __total_bytes; return(__result); } else if (__bytes_left >= __size) { __nobjs = (int)(__bytes_left/__size); __total_bytes = __size * __nobjs; __result = _S_start_free; _S_start_free += __total_bytes; return(__result); } else { size_t __bytes_to_get = 2 * __total_bytes + _S_round_up(_S_heap_size >> 4); if (__bytes_left > 0) { _Obj* * __my_free_list = _S_free_list + _S_freelist_index(__bytes_left); ((_Obj*)_S_start_free) -> _M_free_list_link = *__my_free_list; *__my_free_list = (_Obj*)_S_start_free; } _S_start_free = (char*)malloc(__bytes_to_get); if (0 == _S_start_free) { size_t __i; _Obj* * __my_free_list; _Obj* __p; for (__i = __size; __i <= _MAX_BYTES; __i += _ALIGN) { __my_free_list = _S_free_list + _S_freelist_index(__i); __p = *__my_free_list; if (0 != __p) { *__my_free_list = __p -> _M_free_list_link; _S_start_free = (char*)__p; _S_end_free = _S_start_free + __i; return(_S_chunk_alloc(__size, __nobjs)); } } _S_end_free = 0; _S_start_free = (char*)malloc_alloc::allocate(__bytes_to_get); } _S_heap_size += __bytes_to_get; _S_end_free = _S_start_free + __bytes_to_get; return(_S_chunk_alloc(__size, __nobjs)); } } template void* __default_alloc_template<__threads, __inst>::_S_refill(size_t __n) { int __nobjs = 20; char* __chunk = _S_chunk_alloc(__n, __nobjs); _Obj* * __my_free_list; _Obj* __result; _Obj* __current_obj; _Obj* __next_obj; int __i; if (1 == __nobjs) return(__chunk); __my_free_list = _S_free_list + _S_freelist_index(__n); __result = (_Obj*)__chunk; *__my_free_list = __next_obj = (_Obj*)(__chunk + __n); for (__i = 1; ; __i++) { __current_obj = __next_obj; __next_obj = (_Obj*)((char*)__next_obj + __n); if (__nobjs - 1 == __i) { __current_obj -> _M_free_list_link = 0; break; } else { __current_obj -> _M_free_list_link = __next_obj; } } return(__result); } template 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 (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p); __result = allocate(__new_sz); __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz; memcpy(__result, __p, __copy_sz); deallocate(__p, __old_sz); return(__result); } # 602 "/usr/include/g++/stl_alloc.h" 3 # 689 "/usr/include/g++/stl_alloc.h" 3 template char* __default_alloc_template<__threads, __inst>::_S_start_free = 0; template char* __default_alloc_template<__threads, __inst>::_S_end_free = 0; template size_t __default_alloc_template<__threads, __inst>::_S_heap_size = 0; template __default_alloc_template<__threads, __inst>::_Obj* __default_alloc_template<__threads, __inst> ::_S_free_list[ _NFREELISTS ] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; template class allocator { typedef alloc _Alloc; public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef const _Tp* const_pointer; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp value_type; template struct rebind { typedef allocator<_Tp1> other; }; allocator() throw() {} allocator(const allocator&) throw() {} template allocator(const allocator<_Tp1>&) throw() {} ~allocator() throw() {} pointer address(reference __x) const { return &__x; } const_pointer address(const_reference __x) const { return &__x; } _Tp* allocate(size_type __n, const void* = 0) { return __n != 0 ? static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp))) : 0; } void deallocate(pointer __p, size_type __n) { _Alloc::deallocate(__p, __n * sizeof(_Tp)); } size_type max_size() const throw() { return size_t(-1) / sizeof(_Tp); } void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); } void destroy(pointer __p) { __p->~_Tp(); } }; template<> class allocator { typedef size_t size_type; typedef ptrdiff_t difference_type; typedef void* pointer; typedef const void* const_pointer; typedef void value_type; template struct rebind { typedef allocator<_Tp1> other; }; }; template inline bool operator==(const allocator<_T1>&, const allocator<_T2>&) { return true; } template inline bool operator!=(const allocator<_T1>&, const allocator<_T2>&) { return false; } template struct __allocator { _Alloc __underlying_alloc; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef const _Tp* const_pointer; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp value_type; template struct rebind { typedef __allocator<_Tp1, _Alloc> other; }; __allocator() throw() {} __allocator(const __allocator& __a) throw() : __underlying_alloc(__a.__underlying_alloc) {} template __allocator(const __allocator<_Tp1, _Alloc>& __a) throw() : __underlying_alloc(__a.__underlying_alloc) {} ~__allocator() throw() {} pointer address(reference __x) const { return &__x; } const_pointer address(const_reference __x) const { return &__x; } _Tp* allocate(size_type __n, const void* = 0) { return __n != 0 ? static_cast<_Tp*>(__underlying_alloc.allocate(__n * sizeof(_Tp))) : 0; } void deallocate(pointer __p, size_type __n) { __underlying_alloc.deallocate(__p, __n * sizeof(_Tp)); } size_type max_size() const throw() { return size_t(-1) / sizeof(_Tp); } void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); } void destroy(pointer __p) { __p->~_Tp(); } }; template class __allocator { typedef size_t size_type; typedef ptrdiff_t difference_type; typedef void* pointer; typedef const void* const_pointer; typedef void value_type; template struct rebind { typedef __allocator<_Tp1, _Alloc> other; }; }; template inline bool operator==(const __allocator<_Tp, _Alloc>& __a1, const __allocator<_Tp, _Alloc>& __a2) { return __a1.__underlying_alloc == __a2.__underlying_alloc; } template inline bool operator!=(const __allocator<_Tp, _Alloc>& __a1, const __allocator<_Tp, _Alloc>& __a2) { return __a1.__underlying_alloc != __a2.__underlying_alloc; } template inline bool operator==(const __malloc_alloc_template&, const __malloc_alloc_template&) { return true; } template inline bool operator!=(const __malloc_alloc_template<__inst>&, const __malloc_alloc_template<__inst>&) { return false; } template inline bool operator==(const __default_alloc_template<__threads, __inst>&, const __default_alloc_template<__threads, __inst>&) { return true; } template inline bool operator!=(const __default_alloc_template<__threads, __inst>&, const __default_alloc_template<__threads, __inst>&) { return false; } template inline bool operator==(const debug_alloc<_Alloc>&, const debug_alloc<_Alloc>&) { return true; } template inline bool operator!=(const debug_alloc<_Alloc>&, const debug_alloc<_Alloc>&) { return false; } template struct _Alloc_traits { static const bool _S_instanceless = false; typedef typename _Allocator:: rebind<_Tp>::other allocator_type; }; template const bool _Alloc_traits<_Tp, _Allocator>::_S_instanceless; template struct _Alloc_traits<_Tp, allocator<_Tp1> > { static const bool _S_instanceless = true; typedef simple_alloc<_Tp, alloc> _Alloc_type; typedef allocator<_Tp> allocator_type; }; template struct _Alloc_traits<_Tp, __malloc_alloc_template<__inst> > { static const bool _S_instanceless = true; typedef simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type; typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type; }; template struct _Alloc_traits<_Tp, __default_alloc_template<__threads, __inst> > { static const bool _S_instanceless = true; typedef simple_alloc<_Tp, __default_alloc_template<__threads, __inst> > _Alloc_type; typedef __allocator<_Tp, __default_alloc_template<__threads, __inst> > allocator_type; }; template struct _Alloc_traits<_Tp, debug_alloc<_Alloc> > { static const bool _S_instanceless = true; typedef simple_alloc<_Tp, debug_alloc<_Alloc> > _Alloc_type; typedef __allocator<_Tp, debug_alloc<_Alloc> > allocator_type; }; template struct _Alloc_traits<_Tp, __allocator<_Tp1, __malloc_alloc_template<__inst> > > { static const bool _S_instanceless = true; typedef simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type; typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type; }; template struct _Alloc_traits<_Tp, __allocator<_Tp1, __default_alloc_template<__thr, __inst> > > { static const bool _S_instanceless = true; typedef simple_alloc<_Tp, __default_alloc_template<__thr,__inst> > _Alloc_type; typedef __allocator<_Tp, __default_alloc_template<__thr,__inst> > allocator_type; }; template struct _Alloc_traits<_Tp, __allocator<_Tp1, debug_alloc<_Alloc> > > { static const bool _S_instanceless = true; typedef simple_alloc<_Tp, debug_alloc<_Alloc> > _Alloc_type; typedef __allocator<_Tp, debug_alloc<_Alloc> > allocator_type; }; # 31 "/usr/include/g++/vector" 2 3 # 1 "/usr/include/g++/stl_construct.h" 1 3 template inline void destroy(_Tp* __pointer) { __pointer->~_Tp(); } template inline void construct(_T1* __p, const _T2& __value) { new (__p) _T1(__value); } template inline void construct(_T1* __p) { new (__p) _T1(); } 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, _Tp*) { typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor; __destroy_aux(__first, __last, _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*) {} # 32 "/usr/include/g++/vector" 2 3 # 1 "/usr/include/g++/stl_uninitialized.h" 1 3 template inline _ForwardIter __uninitialized_copy_aux(_InputIter __first, _InputIter __last, _ForwardIter __result, __true_type) { return copy(__first, __last, __result); } template _ForwardIter __uninitialized_copy_aux(_InputIter __first, _InputIter __last, _ForwardIter __result, __false_type) { _ForwardIter __cur = __result; try { for ( ; __first != __last; ++__first, ++__cur) construct(&*__cur, *__first); return __cur; } catch(...) { destroy(__result, __cur) ; throw; } ; } template inline _ForwardIter __uninitialized_copy(_InputIter __first, _InputIter __last, _ForwardIter __result, _Tp*) { typedef typename __type_traits<_Tp>::is_POD_type _Is_POD; return __uninitialized_copy_aux(__first, __last, __result, _Is_POD()); } template inline _ForwardIter uninitialized_copy(_InputIter __first, _InputIter __last, _ForwardIter __result) { return __uninitialized_copy(__first, __last, __result, __value_type( __result ) ); } inline char* uninitialized_copy(const char* __first, const char* __last, char* __result) { memmove(__result, __first, __last - __first); return __result + (__last - __first); } inline wchar_t* uninitialized_copy(const wchar_t* __first, const wchar_t* __last, wchar_t* __result) { memmove(__result, __first, sizeof(wchar_t) * (__last - __first)); return __result + (__last - __first); } template pair<_InputIter, _ForwardIter> __uninitialized_copy_n(_InputIter __first, _Size __count, _ForwardIter __result, input_iterator_tag) { _ForwardIter __cur = __result; try { for ( ; __count > 0 ; --__count, ++__first, ++__cur) construct(&*__cur, *__first); return pair<_InputIter, _ForwardIter>(__first, __cur); } catch(...) { destroy(__result, __cur) ; throw; } ; } template inline pair<_RandomAccessIter, _ForwardIter> __uninitialized_copy_n(_RandomAccessIter __first, _Size __count, _ForwardIter __result, random_access_iterator_tag) { _RandomAccessIter __last = __first + __count; return pair<_RandomAccessIter, _ForwardIter>( __last, uninitialized_copy(__first, __last, __result)); } template inline pair<_InputIter, _ForwardIter> __uninitialized_copy_n(_InputIter __first, _Size __count, _ForwardIter __result) { return __uninitialized_copy_n(__first, __count, __result, __iterator_category( __first ) ); } template inline pair<_InputIter, _ForwardIter> uninitialized_copy_n(_InputIter __first, _Size __count, _ForwardIter __result) { return __uninitialized_copy_n(__first, __count, __result, __iterator_category( __first ) ); } template inline void __uninitialized_fill_aux(_ForwardIter __first, _ForwardIter __last, const _Tp& __x, __true_type) { fill(__first, __last, __x); } template void __uninitialized_fill_aux(_ForwardIter __first, _ForwardIter __last, const _Tp& __x, __false_type) { _ForwardIter __cur = __first; try { for ( ; __cur != __last; ++__cur) construct(&*__cur, __x); } catch(...) { destroy(__first, __cur) ; throw; } ; } template inline void __uninitialized_fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __x, _Tp1*) { typedef typename __type_traits<_Tp1>::is_POD_type _Is_POD; __uninitialized_fill_aux(__first, __last, __x, _Is_POD()); } template inline void uninitialized_fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __x) { __uninitialized_fill(__first, __last, __x, __value_type( __first ) ); } template inline _ForwardIter __uninitialized_fill_n_aux(_ForwardIter __first, _Size __n, const _Tp& __x, __true_type) { return fill_n(__first, __n, __x); } template _ForwardIter __uninitialized_fill_n_aux(_ForwardIter __first, _Size __n, const _Tp& __x, __false_type) { _ForwardIter __cur = __first; try { for ( ; __n > 0; --__n, ++__cur) construct(&*__cur, __x); return __cur; } catch(...) { destroy(__first, __cur) ; throw; } ; } template inline _ForwardIter __uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x, _Tp1*) { typedef typename __type_traits<_Tp1>::is_POD_type _Is_POD; return __uninitialized_fill_n_aux(__first, __n, __x, _Is_POD()); } template inline _ForwardIter uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x) { return __uninitialized_fill_n(__first, __n, __x, __value_type( __first ) ); } template inline _ForwardIter __uninitialized_copy_copy(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _ForwardIter __result) { _ForwardIter __mid = uninitialized_copy(__first1, __last1, __result); try { return uninitialized_copy(__first2, __last2, __mid); } catch(...) { destroy(__result, __mid) ; throw; } ; } template inline _ForwardIter __uninitialized_fill_copy(_ForwardIter __result, _ForwardIter __mid, const _Tp& __x, _InputIter __first, _InputIter __last) { uninitialized_fill(__result, __mid, __x); try { return uninitialized_copy(__first, __last, __mid); } catch(...) { destroy(__result, __mid) ; throw; } ; } template inline void __uninitialized_copy_fill(_InputIter __first1, _InputIter __last1, _ForwardIter __first2, _ForwardIter __last2, const _Tp& __x) { _ForwardIter __mid2 = uninitialized_copy(__first1, __last1, __first2); try { uninitialized_fill(__mid2, __last2, __x); } catch(...) { destroy(__first2, __mid2) ; throw; } ; } # 33 "/usr/include/g++/vector" 2 3 # 1 "/usr/include/g++/stl_vector.h" 1 3 template class _Vector_alloc_base { public: typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type allocator_type; allocator_type get_allocator() const { return _M_data_allocator; } _Vector_alloc_base(const allocator_type& __a) : _M_data_allocator(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0) {} protected: allocator_type _M_data_allocator; _Tp* _M_start; _Tp* _M_finish; _Tp* _M_end_of_storage; _Tp* _M_allocate(size_t __n) { return _M_data_allocator.allocate(__n); } void _M_deallocate(_Tp* __p, size_t __n) { if (__p) _M_data_allocator.deallocate(__p, __n); } }; template class _Vector_alloc_base<_Tp, _Allocator, true> { public: typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type allocator_type; allocator_type get_allocator() const { return allocator_type(); } _Vector_alloc_base(const allocator_type&) : _M_start(0), _M_finish(0), _M_end_of_storage(0) {} protected: _Tp* _M_start; _Tp* _M_finish; _Tp* _M_end_of_storage; typedef typename _Alloc_traits<_Tp, _Allocator>::_Alloc_type _Alloc_type; _Tp* _M_allocate(size_t __n) { return _Alloc_type::allocate(__n); } void _M_deallocate(_Tp* __p, size_t __n) { _Alloc_type::deallocate(__p, __n);} }; template struct _Vector_base : public _Vector_alloc_base<_Tp, _Alloc, _Alloc_traits<_Tp, _Alloc>::_S_instanceless> { typedef _Vector_alloc_base<_Tp, _Alloc, _Alloc_traits<_Tp, _Alloc>::_S_instanceless> _Base; typedef typename _Base::allocator_type allocator_type; _Vector_base(const allocator_type& __a) : _Base(__a) {} _Vector_base(size_t __n, const allocator_type& __a) : _Base(__a) { _M_start = _M_allocate(__n); _M_finish = _M_start; _M_end_of_storage = _M_start + __n; } ~_Vector_base() { _M_deallocate(_M_start, _M_end_of_storage - _M_start); } }; # 150 "/usr/include/g++/stl_vector.h" 3 template > class vector : protected _Vector_base<_Tp, _Alloc> { private: typedef _Vector_base<_Tp, _Alloc> _Base; public: typedef _Tp value_type; typedef value_type* pointer; typedef const value_type* const_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 typename _Base::allocator_type allocator_type; allocator_type get_allocator() const { return _Base::get_allocator(); } typedef reverse_iterator const_reverse_iterator; typedef reverse_iterator reverse_iterator; protected: using _Base::_M_allocate; using _Base::_M_deallocate; using _Base::_M_start; using _Base::_M_finish; using _Base::_M_end_of_storage; protected: void _M_insert_aux(iterator __position, const _Tp& __x); void _M_insert_aux(iterator __position); public: iterator begin() { return _M_start; } const_iterator begin() const { return _M_start; } iterator end() { return _M_finish; } const_iterator end() const { return _M_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) / sizeof(_Tp); } size_type capacity() const { return size_type(_M_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); } explicit vector(const allocator_type& __a = allocator_type()) : _Base(__a) {} vector(size_type __n, const _Tp& __value, const allocator_type& __a = allocator_type()) : _Base(__n, __a) { _M_finish = uninitialized_fill_n(_M_start, __n, __value); } explicit vector(size_type __n) : _Base(__n, allocator_type()) { _M_finish = uninitialized_fill_n(_M_start, __n, _Tp()); } vector(const vector<_Tp, _Alloc>& __x) : _Base(__x.size(), __x.get_allocator()) { _M_finish = uninitialized_copy(__x.begin(), __x.end(), _M_start); } template vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a = allocator_type()) : _Base(__a) { typedef typename _Is_integer<_InputIterator>::_Integral _Integral; _M_initialize_aux(__first, __last, _Integral()); } template void _M_initialize_aux(_Integer __n, _Integer __value, __true_type) { _M_start = _M_allocate(__n); _M_end_of_storage = _M_start + __n; _M_finish = uninitialized_fill_n(_M_start, __n, __value); } template void _M_initialize_aux(_InputIterator __first, _InputIterator __last, __false_type) { _M_range_initialize(__first, __last, __iterator_category( __first ) ); } ~vector() { destroy(_M_start, _M_finish); } vector<_Tp, _Alloc>& operator=(const vector<_Tp, _Alloc>& __x); void reserve(size_type __n) { if (capacity() < __n) { const size_type __old_size = size(); iterator __tmp = _M_allocate_and_copy(__n, _M_start, _M_finish); destroy(_M_start, _M_finish); _M_deallocate(_M_start, _M_end_of_storage - _M_start); _M_start = __tmp; _M_finish = __tmp + __old_size; _M_end_of_storage = _M_start + __n; } } void assign(size_type __n, const _Tp& __val); template void assign(_InputIterator __first, _InputIterator __last) { typedef typename _Is_integer<_InputIterator>::_Integral _Integral; _M_assign_dispatch(__first, __last, _Integral()); } template void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) { assign((size_type) __n, (_Tp) __val); } template void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type) { _M_assign_aux(__first, __last, __iterator_category( __first ) ); } template void _M_assign_aux(_InputIterator __first, _InputIterator __last, input_iterator_tag); template void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, forward_iterator_tag); 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 _Tp& __x) { if (_M_finish != _M_end_of_storage) { construct(_M_finish, __x); ++_M_finish; } else _M_insert_aux(end(), __x); } void push_back() { if (_M_finish != _M_end_of_storage) { construct(_M_finish); ++_M_finish; } else _M_insert_aux(end()); } void swap(vector<_Tp, _Alloc>& __x) { ::swap(_M_start, __x._M_start); ::swap(_M_finish, __x._M_finish); ::swap(_M_end_of_storage, __x._M_end_of_storage); } iterator insert(iterator __position, const _Tp& __x) { size_type __n = __position - begin(); if (_M_finish != _M_end_of_storage && __position == end()) { construct(_M_finish, __x); ++_M_finish; } else _M_insert_aux(__position, __x); return begin() + __n; } iterator insert(iterator __position) { size_type __n = __position - begin(); if (_M_finish != _M_end_of_storage && __position == end()) { construct(_M_finish); ++_M_finish; } else _M_insert_aux(__position); return begin() + __n; } template void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { typedef typename _Is_integer<_InputIterator>::_Integral _Integral; _M_insert_dispatch(__pos, __first, __last, _Integral()); } template void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, __true_type) { insert(__pos, (size_type) __n, (_Tp) __val); } template void _M_insert_dispatch(iterator __pos, _InputIterator __first, _InputIterator __last, __false_type) { _M_range_insert(__pos, __first, __last, __iterator_category( __first ) ); } void insert (iterator __pos, size_type __n, const _Tp& __x); void pop_back() { --_M_finish; destroy(_M_finish); } iterator erase(iterator __position) { if (__position + 1 != end()) copy(__position + 1, _M_finish, __position); --_M_finish; destroy(_M_finish); return __position; } iterator erase(iterator __first, iterator __last) { iterator __i = copy(__last, _M_finish, __first); destroy(__i, _M_finish); _M_finish = _M_finish - (__last - __first); return __first; } void resize(size_type __new_size, const _Tp& __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, _Tp()); } void clear() { erase(begin(), end()); } protected: template iterator _M_allocate_and_copy(size_type __n, _ForwardIterator __first, _ForwardIterator __last) { iterator __result = _M_allocate(__n); try { uninitialized_copy(__first, __last, __result); return __result; } catch(...) { _M_deallocate(__result, __n) ; throw; } ; } # 440 "/usr/include/g++/stl_vector.h" 3 template void _M_range_initialize(_InputIterator __first, _InputIterator __last, input_iterator_tag) { for ( ; __first != __last; ++__first) push_back(*__first); } template void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, forward_iterator_tag) { size_type __n = 0; distance(__first, __last, __n); _M_start = _M_allocate(__n); _M_end_of_storage = _M_start + __n; _M_finish = uninitialized_copy(__first, __last, _M_start); } template void _M_range_insert(iterator __pos, _InputIterator __first, _InputIterator __last, input_iterator_tag); template void _M_range_insert(iterator __pos, _ForwardIterator __first, _ForwardIterator __last, forward_iterator_tag); }; template inline bool operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { return __x.size() == __y.size() && equal(__x.begin(), __x.end(), __y.begin()); } template inline bool operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { return lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } template inline void swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y) { __x.swap(__y); } template vector<_Tp,_Alloc>& vector<_Tp,_Alloc>::operator=(const vector<_Tp, _Alloc>& __x) { if (&__x != this) { const size_type __xlen = __x.size(); if (__xlen > capacity()) { iterator __tmp = _M_allocate_and_copy(__xlen, __x.begin(), __x.end()); destroy(_M_start, _M_finish); _M_deallocate(_M_start, _M_end_of_storage - _M_start); _M_start = __tmp; _M_end_of_storage = _M_start + __xlen; } else if (size() >= __xlen) { iterator __i = copy(__x.begin(), __x.end(), begin()); destroy(__i, _M_finish); } else { copy(__x.begin(), __x.begin() + size(), _M_start); uninitialized_copy(__x.begin() + size(), __x.end(), _M_finish); } _M_finish = _M_start + __xlen; } return *this; } template void vector<_Tp, _Alloc>::assign(size_t __n, const value_type& __val) { if (__n > capacity()) { vector<_Tp, _Alloc> __tmp(__n, __val, get_allocator()); __tmp.swap(*this); } else if (__n > size()) { fill(begin(), end(), __val); _M_finish = uninitialized_fill_n(_M_finish, __n - size(), __val); } else erase(fill_n(begin(), __n, __val), end()); } template template void vector<_Tp, _Alloc>::_M_assign_aux(_InputIter __first, _InputIter __last, input_iterator_tag) { iterator __cur = begin(); for ( ; __first != __last && __cur != end(); ++__cur, ++__first) *__cur = *__first; if (__first == __last) erase(__cur, end()); else insert(end(), __first, __last); } template template void vector<_Tp, _Alloc>::_M_assign_aux(_ForwardIter __first, _ForwardIter __last, forward_iterator_tag) { size_type __len = 0; distance(__first, __last, __len); if (__len > capacity()) { iterator __tmp = _M_allocate_and_copy(__len, __first, __last); destroy(_M_start, _M_finish); _M_deallocate(_M_start, _M_end_of_storage - _M_start); _M_start = __tmp; _M_end_of_storage = _M_finish = _M_start + __len; } else if (size() >= __len) { iterator __new_finish = copy(__first, __last, _M_start); destroy(__new_finish, _M_finish); _M_finish = __new_finish; } else { _ForwardIter __mid = __first; advance(__mid, size()); copy(__first, __mid, _M_start); _M_finish = uninitialized_copy(__mid, __last, _M_finish); } } template void vector<_Tp, _Alloc>::_M_insert_aux(iterator __position, const _Tp& __x) { if (_M_finish != _M_end_of_storage) { construct(_M_finish, *(_M_finish - 1)); ++_M_finish; _Tp __x_copy = __x; copy_backward(__position, _M_finish - 2, _M_finish - 1); *__position = __x_copy; } else { const size_type __old_size = size(); const size_type __len = __old_size != 0 ? 2 * __old_size : 1; iterator __new_start = _M_allocate(__len); iterator __new_finish = __new_start; try { __new_finish = uninitialized_copy(_M_start, __position, __new_start); construct(__new_finish, __x); ++__new_finish; __new_finish = uninitialized_copy(__position, _M_finish, __new_finish); } catch(...) { (destroy(__new_start,__new_finish), _M_deallocate(__new_start,__len)) ; throw; } ; destroy(begin(), end()); _M_deallocate(_M_start, _M_end_of_storage - _M_start); _M_start = __new_start; _M_finish = __new_finish; _M_end_of_storage = __new_start + __len; } } template void vector<_Tp, _Alloc>::_M_insert_aux(iterator __position) { if (_M_finish != _M_end_of_storage) { construct(_M_finish, *(_M_finish - 1)); ++_M_finish; copy_backward(__position, _M_finish - 2, _M_finish - 1); *__position = _Tp(); } else { const size_type __old_size = size(); const size_type __len = __old_size != 0 ? 2 * __old_size : 1; iterator __new_start = _M_allocate(__len); iterator __new_finish = __new_start; try { __new_finish = uninitialized_copy(_M_start, __position, __new_start); construct(__new_finish); ++__new_finish; __new_finish = uninitialized_copy(__position, _M_finish, __new_finish); } catch(...) { (destroy(__new_start,__new_finish), _M_deallocate(__new_start,__len)) ; throw; } ; destroy(begin(), end()); _M_deallocate(_M_start, _M_end_of_storage - _M_start); _M_start = __new_start; _M_finish = __new_finish; _M_end_of_storage = __new_start + __len; } } template void vector<_Tp, _Alloc>::insert(iterator __position, size_type __n, const _Tp& __x) { if (__n != 0) { if (size_type(_M_end_of_storage - _M_finish) >= __n) { _Tp __x_copy = __x; const size_type __elems_after = _M_finish - __position; iterator __old_finish = _M_finish; if (__elems_after > __n) { uninitialized_copy(_M_finish - __n, _M_finish, _M_finish); _M_finish += __n; copy_backward(__position, __old_finish - __n, __old_finish); fill(__position, __position + __n, __x_copy); } else { uninitialized_fill_n(_M_finish, __n - __elems_after, __x_copy); _M_finish += __n - __elems_after; uninitialized_copy(__position, __old_finish, _M_finish); _M_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); iterator __new_start = _M_allocate(__len); iterator __new_finish = __new_start; try { __new_finish = uninitialized_copy(_M_start, __position, __new_start); __new_finish = uninitialized_fill_n(__new_finish, __n, __x); __new_finish = uninitialized_copy(__position, _M_finish, __new_finish); } catch(...) { (destroy(__new_start,__new_finish), _M_deallocate(__new_start,__len)) ; throw; } ; destroy(_M_start, _M_finish); _M_deallocate(_M_start, _M_end_of_storage - _M_start); _M_start = __new_start; _M_finish = __new_finish; _M_end_of_storage = __new_start + __len; } } } template template void vector<_Tp, _Alloc>::_M_range_insert(iterator __pos, _InputIterator __first, _InputIterator __last, input_iterator_tag) { for ( ; __first != __last; ++__first) { __pos = insert(__pos, *__first); ++__pos; } } template template void vector<_Tp, _Alloc>::_M_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(_M_end_of_storage - _M_finish) >= __n) { const size_type __elems_after = _M_finish - __position; iterator __old_finish = _M_finish; if (__elems_after > __n) { uninitialized_copy(_M_finish - __n, _M_finish, _M_finish); _M_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, _M_finish); _M_finish += __n - __elems_after; uninitialized_copy(__position, __old_finish, _M_finish); _M_finish += __elems_after; copy(__first, __mid, __position); } } else { const size_type __old_size = size(); const size_type __len = __old_size + max(__old_size, __n); iterator __new_start = _M_allocate(__len); iterator __new_finish = __new_start; try { __new_finish = uninitialized_copy(_M_start, __position, __new_start); __new_finish = uninitialized_copy(__first, __last, __new_finish); __new_finish = uninitialized_copy(__position, _M_finish, __new_finish); } catch(...) { (destroy(__new_start,__new_finish), _M_deallocate(__new_start,__len)) ; throw; } ; destroy(_M_start, _M_finish); _M_deallocate(_M_start, _M_end_of_storage - _M_start); _M_start = __new_start; _M_finish = __new_finish; _M_end_of_storage = __new_start + __len; } } } # 810 "/usr/include/g++/stl_vector.h" 3 # 34 "/usr/include/g++/vector" 2 3 # 1 "/usr/include/g++/stl_bvector.h" 1 3 static const int __WORD_BIT = int(8 *sizeof(unsigned int)); struct _Bit_reference { unsigned int* _M_p; unsigned int _M_mask; _Bit_reference(unsigned int* __x, unsigned int __y) : _M_p(__x), _M_mask(__y) {} public: _Bit_reference() : _M_p(0), _M_mask(0) {} operator bool() const { return !(!(*_M_p & _M_mask)); } _Bit_reference& operator=(bool __x) { if (__x) *_M_p |= _M_mask; else *_M_p &= ~_M_mask; return *this; } _Bit_reference& operator=(const _Bit_reference& __x) { return *this = bool(__x); } bool operator==(const _Bit_reference& __x) const { return bool(*this) == bool(__x); } bool operator<(const _Bit_reference& __x) const { return !bool(*this) && bool(__x); } void flip() { *_M_p ^= _M_mask; } }; inline void swap(_Bit_reference __x, _Bit_reference __y) { bool __tmp = __x; __x = __y; __y = __tmp; } struct _Bit_iterator : public random_access_iterator { typedef _Bit_reference reference; typedef _Bit_reference* pointer; typedef _Bit_iterator iterator; unsigned int* _M_p; unsigned int _M_offset; void bump_up() { if (_M_offset++ == __WORD_BIT - 1) { _M_offset = 0; ++_M_p; } } void bump_down() { if (_M_offset-- == 0) { _M_offset = __WORD_BIT - 1; --_M_p; } } _Bit_iterator() : _M_p(0), _M_offset(0) {} _Bit_iterator(unsigned int* __x, unsigned int __y) : _M_p(__x), _M_offset(__y) {} reference operator*() const { return reference(_M_p, 1U << _M_offset); } iterator& operator++() { bump_up(); return *this; } iterator operator++(int) { iterator __tmp = *this; bump_up(); return __tmp; } iterator& operator--() { bump_down(); return *this; } iterator operator--(int) { iterator __tmp = *this; bump_down(); return __tmp; } iterator& operator+=(difference_type __i) { difference_type __n = __i + _M_offset; _M_p += __n / __WORD_BIT; __n = __n % __WORD_BIT; if (__n < 0) { _M_offset = (unsigned int) __n + __WORD_BIT; --_M_p; } else _M_offset = (unsigned int) __n; return *this; } iterator& operator-=(difference_type __i) { *this += -__i; return *this; } iterator operator+(difference_type __i) const { iterator __tmp = *this; return __tmp += __i; } iterator operator-(difference_type __i) const { iterator __tmp = *this; return __tmp -= __i; } difference_type operator-(iterator __x) const { return __WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset; } reference operator[](difference_type __i) { return *(*this + __i); } bool operator==(const iterator& __x) const { return _M_p == __x._M_p && _M_offset == __x._M_offset; } bool operator!=(const iterator& __x) const { return _M_p != __x._M_p || _M_offset != __x._M_offset; } bool operator<(iterator __x) const { return _M_p < __x._M_p || (_M_p == __x._M_p && _M_offset < __x._M_offset); } }; struct _Bit_const_iterator : public random_access_iterator { typedef bool reference; typedef bool const_reference; typedef const bool* pointer; typedef _Bit_const_iterator const_iterator; unsigned int* _M_p; unsigned int _M_offset; void bump_up() { if (_M_offset++ == __WORD_BIT - 1) { _M_offset = 0; ++_M_p; } } void bump_down() { if (_M_offset-- == 0) { _M_offset = __WORD_BIT - 1; --_M_p; } } _Bit_const_iterator() : _M_p(0), _M_offset(0) {} _Bit_const_iterator(unsigned int* __x, unsigned int __y) : _M_p(__x), _M_offset(__y) {} _Bit_const_iterator(const _Bit_iterator& __x) : _M_p(__x._M_p), _M_offset(__x._M_offset) {} const_reference operator*() const { return _Bit_reference(_M_p, 1U << _M_offset); } const_iterator& operator++() { bump_up(); return *this; } const_iterator operator++(int) { const_iterator __tmp = *this; bump_up(); return __tmp; } const_iterator& operator--() { bump_down(); return *this; } const_iterator operator--(int) { const_iterator __tmp = *this; bump_down(); return __tmp; } const_iterator& operator+=(difference_type __i) { difference_type __n = __i + _M_offset; _M_p += __n / __WORD_BIT; __n = __n % __WORD_BIT; if (__n < 0) { _M_offset = (unsigned int) __n + __WORD_BIT; --_M_p; } else _M_offset = (unsigned int) __n; return *this; } const_iterator& operator-=(difference_type __i) { *this += -__i; return *this; } const_iterator operator+(difference_type __i) const { const_iterator __tmp = *this; return __tmp += __i; } const_iterator operator-(difference_type __i) const { const_iterator __tmp = *this; return __tmp -= __i; } difference_type operator-(const_iterator __x) const { return __WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset; } const_reference operator[](difference_type __i) { return *(*this + __i); } bool operator==(const const_iterator& __x) const { return _M_p == __x._M_p && _M_offset == __x._M_offset; } bool operator!=(const const_iterator& __x) const { return _M_p != __x._M_p || _M_offset != __x._M_offset; } bool operator<(const_iterator __x) const { return _M_p < __x._M_p || (_M_p == __x._M_p && _M_offset < __x._M_offset); } }; template class _Bvector_alloc_base { public: typedef typename _Alloc_traits::allocator_type allocator_type; allocator_type get_allocator() const { return _M_data_allocator; } _Bvector_alloc_base(const allocator_type& __a) : _M_data_allocator(__a), _M_start(), _M_finish(), _M_end_of_storage(0) {} protected: unsigned int* _M_bit_alloc(size_t __n) { return _M_data_allocator.allocate((__n + __WORD_BIT - 1)/__WORD_BIT); } void _M_deallocate() { if (_M_start._M_p) _M_data_allocator.deallocate(_M_start._M_p, _M_end_of_storage - _M_start._M_p); } typename _Alloc_traits::allocator_type _M_data_allocator; _Bit_iterator _M_start; _Bit_iterator _M_finish; unsigned int* _M_end_of_storage; }; template class _Bvector_alloc_base<_Allocator, true> { public: typedef typename _Alloc_traits::allocator_type allocator_type; allocator_type get_allocator() const { return allocator_type(); } _Bvector_alloc_base(const allocator_type&) : _M_start(), _M_finish(), _M_end_of_storage(0) {} protected: typedef typename _Alloc_traits::_Alloc_type _Alloc_type; unsigned int* _M_bit_alloc(size_t __n) { return _Alloc_type::allocate((__n + __WORD_BIT - 1)/__WORD_BIT); } void _M_deallocate() { if (_M_start._M_p) _Alloc_type::deallocate(_M_start._M_p, _M_end_of_storage - _M_start._M_p); } _Bit_iterator _M_start; _Bit_iterator _M_finish; unsigned int* _M_end_of_storage; }; template class _Bvector_base : public _Bvector_alloc_base<_Alloc, _Alloc_traits::_S_instanceless> { typedef _Bvector_alloc_base<_Alloc, _Alloc_traits::_S_instanceless> _Base; public: typedef typename _Base::allocator_type allocator_type; _Bvector_base(const allocator_type& __a) : _Base(__a) {} ~_Bvector_base() { _Base::_M_deallocate(); } }; # 348 "/usr/include/g++/stl_bvector.h" 3 template class vector : public _Bvector_base<_Alloc> { typedef _Bvector_base<_Alloc> _Base; public: typedef bool value_type; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Bit_reference reference; typedef bool const_reference; typedef _Bit_reference* pointer; typedef const bool* const_pointer; typedef _Bit_iterator iterator; typedef _Bit_const_iterator const_iterator; typedef reverse_iterator const_reverse_iterator; typedef reverse_iterator reverse_iterator; typedef typename _Base::allocator_type allocator_type; allocator_type get_allocator() const { return _Base::get_allocator(); } protected: protected: void _M_initialize(size_type __n) { unsigned int* __q = _M_bit_alloc(__n); _M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__WORD_BIT; _M_start = iterator(__q, 0); _M_finish = _M_start + difference_type(__n); } void _M_insert_aux(iterator __position, bool __x) { if (_M_finish._M_p != _M_end_of_storage) { copy_backward(__position, _M_finish, _M_finish + 1); *__position = __x; ++_M_finish; } else { size_type __len = size() ? 2 * size() : __WORD_BIT; unsigned int* __q = _M_bit_alloc(__len); iterator __i = copy(begin(), __position, iterator(__q, 0)); *__i++ = __x; _M_finish = copy(__position, end(), __i); _M_deallocate(); _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT; _M_start = iterator(__q, 0); } } template void _M_initialize_range(_InputIterator __first, _InputIterator __last, input_iterator_tag) { _M_start = iterator(); _M_finish = iterator(); _M_end_of_storage = 0; for ( ; __first != __last; ++__first) push_back(*__first); } template void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last, forward_iterator_tag) { size_type __n = 0; distance(__first, __last, __n); _M_initialize(__n); copy(__first, __last, _M_start); } template void _M_insert_range(iterator __pos, _InputIterator __first, _InputIterator __last, input_iterator_tag) { for ( ; __first != __last; ++__first) { __pos = insert(__pos, *__first); ++__pos; } } template void _M_insert_range(iterator __position, _ForwardIterator __first, _ForwardIterator __last, forward_iterator_tag) { if (__first != __last) { size_type __n = 0; distance(__first, __last, __n); if (capacity() - size() >= __n) { copy_backward(__position, end(), _M_finish + difference_type(__n)); copy(__first, __last, __position); _M_finish += difference_type(__n); } else { size_type __len = size() + max(size(), __n); unsigned int* __q = _M_bit_alloc(__len); iterator __i = copy(begin(), __position, iterator(__q, 0)); __i = copy(__first, __last, __i); _M_finish = copy(__position, end(), __i); _M_deallocate(); _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT; _M_start = iterator(__q, 0); } } } public: iterator begin() { return _M_start; } const_iterator begin() const { return _M_start; } iterator end() { return _M_finish; } const_iterator end() const { return _M_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(const_iterator(_M_end_of_storage, 0) - begin()); } bool empty() const { return begin() == end(); } reference operator[](size_type __n) { return *(begin() + difference_type(__n)); } const_reference operator[](size_type __n) const { return *(begin() + difference_type(__n)); } explicit vector (const allocator_type& __a = allocator_type()) : _Base(__a) {} vector (size_type __n, bool __value, const allocator_type& __a = allocator_type()) : _Base(__a) { _M_initialize(__n); fill(_M_start._M_p, _M_end_of_storage, __value ? ~0 : 0); } explicit vector (size_type __n) : _Base(allocator_type()) { _M_initialize(__n); fill(_M_start._M_p, _M_end_of_storage, 0); } vector (const vector & __x) : _Base(__x.get_allocator()) { _M_initialize(__x.size()); copy(__x.begin(), __x.end(), _M_start); } template vector (_InputIterator __first, _InputIterator __last, const allocator_type& __a = allocator_type()) : _Base(__a) { typedef typename _Is_integer<_InputIterator>::_Integral _Integral; _M_initialize_dispatch(__first, __last, _Integral()); } template void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) { _M_initialize(__n); fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0); } template void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, __false_type) { _M_initialize_range(__first, __last, __iterator_category( __first ) ); } # 587 "/usr/include/g++/stl_bvector.h" 3 ~vector () { } vector & operator=(const vector & __x) { if (&__x == this) return *this; if (__x.size() > capacity()) { _M_deallocate();