1S01EC148822003E) 16.3.4 Rescanning and further replacement 312 16.3.5 Scope of macro definitions 312 16.4 Line control.... 314 16.5 Error directive...... 314 16.6 Pragma directive. 314 16.7 Null directive...... 3引4 16.8 Predefined macro names. 315 17 Library introduction.. 317 17.I Definitionss.... 317 17.1.1 arbitrary-positional stream 317 17.12 character..... 317 17.1.3 character container type 317 17.1.4 comparison fiunction... 317 17.1.s coepoeent.. 318 17.1.6 default behavior 318 17.1.7 handler function..... 318 17.1.8 iostream class templates 318 17.1.9 modifier function. 318 17.1.10 object state....... 318 17.1.11 narrow-onented iostream elasses 318 17.1.12 NICIS.... 318 17.1.13 observer function.. 318 17.1.14 replacement function 318 17.1.15 required behavior... 318 17.1.16 repositioral stream 319 17.1.17 reserved function. 319 17.l.18 traits class.… 319 17.1.19 wide-oriented iostream classes 319 17.2 Additional definitions... 319 17.3 Method of description (Informative) 319 17.3.1 Structure ofeach subclause 319 17.3.1.1Sumy 320 17.3.12 Requirements 320 17.3.1.3 Specifications 320 17.3.1.4 C Library....... 321 17.3.2 Other conventions. 321 17.3.2.1 Type descriptions. 321 17.3.2.1.1 Emmerated types 322 17.32.12 Bitmask types. 322 17.3.2.1.3 Character sequenoes 323 17.32.13.1 Byte strings..... 323 17.32.132 Multibyte strings 324 17.32.133 Wide-character sequences 324 17.3.2.2 Functions within classes 324 17.3.2.3 Privane members..... 324 ISOEC0a如一相htws4ned
ISO/IEC 14882:2003(E) xii © ISO/IEC 2003 — All rights reserved 16.3.4 Rescanning and further replacement...............................................................................................312 16.3.5 Scope of macro definitions .............................................................................................................312 16.4 Line control ........................................................................................................................................314 16.5 Error directive ....................................................................................................................................314 16.6 Pragma directive ................................................................................................................................314 16.7 Null directive .....................................................................................................................................314 16.8 Predefined macro names ....................................................................................................................315 17 Library introduction ..............................................................................................................................317 17.1 Definitions .........................................................................................................................................317 17.1.1 arbitrary-positional stream ..............................................................................................................317 17.1.2 character ..........................................................................................................................................317 17.1.3 character container type ..................................................................................................................317 17.1.4 comparison function .......................................................................................................................317 17.1.5 component.......................................................................................................................................318 17.1.6 default behavior ..............................................................................................................................318 17.1.7 handler function ..............................................................................................................................318 17.1.8 iostream class templates .................................................................................................................318 17.1.9 modifier function ............................................................................................................................318 17.1.10 object state ....................................................................................................................................318 17.1.11 narrow-oriented iostream classes ..................................................................................................318 17.1.12 NTCTS ..........................................................................................................................................318 17.1.13 observer function ..........................................................................................................................318 17.1.14 replacement function.....................................................................................................................318 17.1.15 required behavior ..........................................................................................................................318 17.1.16 repositional stream ........................................................................................................................319 17.1.17 reserved function...........................................................................................................................319 17.1.18 traits class......................................................................................................................................319 17.1.19 wide-oriented iostream classes .....................................................................................................319 17.2 Additional definitions ........................................................................................................................319 17.3 Method of description (Informative) .................................................................................................319 17.3.1 Structure of each subclause.............................................................................................................319 17.3.1.1 Summary ......................................................................................................................................320 17.3.1.2 Requirements ...............................................................................................................................320 17.3.1.3 Specifications ...............................................................................................................................320 17.3.1.4 C Library ......................................................................................................................................321 17.3.2 Other conventions ...........................................................................................................................321 17.3.2.1 Type descriptions .........................................................................................................................321 17.3.2.1.1 Enumerated types......................................................................................................................322 17.3.2.1.2 Bitmask types............................................................................................................................322 17.3.2.1.3 Character sequences ..................................................................................................................323 17.3.2.1.3.1 Byte strings ............................................................................................................................323 17.3.2.1.3.2 Multibyte strings ....................................................................................................................324 17.3.2.1.3.3 Wide-character sequences ......................................................................................................324 17.3.2.2 Functions within classes ..............................................................................................................324 17.3.2.3 Private members ..........................................................................................................................324
1s01EC14882:2003(曰 17.4 Libeary-wide requirements 324 17.4.1 Libeary coetents and organization 325 174.1.1 Libeafy coetents 325 17.4.12 Headers. 325 174.13 Freestanding implementations..... 326 17.42 Using the library 326 17.4 2.1 Headers 326 17422 Linkage 327 1743 Constraints o programs 7 17A3.】Reserved names 327 17.4 3.1.1 Macro names. 27 174312 Global names...... 327 174313 Extemal linkage.... 44444444444444444444 328 17.43.1.4 Types. 328 174 32 Headers 328 17433 Derived classes… 328 17434 Replacement functions. 328 174 35 Hander functions....... 329 17436 Other funetions 29 17.4 3.7 Function arguments 30 17438 Required paragraph........ 50 17.4.4 Conforming implementations. 30 17.4.4.1 Headers 330 17442 Restrictions on macro definitions 30 17443 Global or non-member functions 50 17444 Member functions.. 331 17445 Reentrancy 331 17446 Protection within classes. 331 17447 Dettved elasses 331 17.4.4.8 Restrictions on exception handling 331 18 Language support library 333 18.1 Types. 33 182 Implementation properties....... 334 182】Numeric limits- 334 182.1.1 Class template nuneric_1inits 334 182.12 numeric_limits members...... 335 182.13 Type float_round_style..... 39 182.14 Type float_denorm_style. 340 182.1.5 numeric_linits specializations 340 1822 C Library 341 18.3 Start and termincatic ni342 184 Dynamic memory management........ 343 18.4.1 Storage allocation and deallocation. 343 184.11 Single-objeet forms 343 18.4.12 Arrary forms. 345 184.13 Placement fofs 345 18.42 Storage allocation erroes 346 18.42.1 Class bad alloc....... 346 18422 Type new handler......... 347 QIS0EC2003一All rights reserved x
ISO/IEC 14882:2003(E) © ISO/IEC 2003 — All rights reserved xiii 17.4 Library-wide requirements ................................................................................................................324 17.4.1 Library contents and organization ..................................................................................................325 17.4.1.1 Library contents ...........................................................................................................................325 17.4.1.2 Headers ........................................................................................................................................325 17.4.1.3 Freestanding implementations .....................................................................................................326 17.4.2 Using the library .............................................................................................................................326 17.4.2.1 Headers ........................................................................................................................................326 17.4.2.2 Linkage ........................................................................................................................................327 17.4.3 Constraints on programs .................................................................................................................327 17.4.3.1 Reserved names ...........................................................................................................................327 17.4.3.1.1 Macro names .............................................................................................................................327 17.4.3.1.2 Global names ............................................................................................................................327 17.4.3.1.3 External linkage ........................................................................................................................328 17.4.3.1.4 Types.........................................................................................................................................328 17.4.3.2 Headers ........................................................................................................................................328 17.4.3.3 Derived classes ............................................................................................................................328 17.4.3.4 Replacement functions.................................................................................................................328 17.4.3.5 Handler functions.........................................................................................................................329 17.4.3.6 Other functions ............................................................................................................................329 17.4.3.7 Function arguments .....................................................................................................................330 17.4.3.8 Required paragraph ......................................................................................................................330 17.4.4 Conforming implementations .........................................................................................................330 17.4.4.1 Headers ........................................................................................................................................330 17.4.4.2 Restrictions on macro definitions ................................................................................................330 17.4.4.3 Global or non-member functions .................................................................................................330 17.4.4.4 Member functions ........................................................................................................................331 17.4.4.5 Reentrancy ...................................................................................................................................331 17.4.4.6 Protection within classes..............................................................................................................331 17.4.4.7 Derived classes ............................................................................................................................331 17.4.4.8 Restrictions on exception handling ..............................................................................................331 18 Language support library ......................................................................................................................333 18.1 Types..................................................................................................................................................333 18.2 Implementation properties .................................................................................................................334 18.2.1 Numeric limits ................................................................................................................................334 18.2.1.1 Class template numeric_limits ...........................................................................................334 18.2.1.2 numeric_limits members ....................................................................................................335 18.2.1.3 Type float_round_style ...................................................................................................339 18.2.1.4 Type float_denorm_style.................................................................................................340 18.2.1.5 numeric_limits specializations ...........................................................................................340 18.2.2 C Library .........................................................................................................................................341 18.3 Start and termination..........................................................................................................................342 18.4 Dynamic memory management .........................................................................................................343 18.4.1 Storage allocation and deallocation ................................................................................................343 18.4.1.1 Single-object forms ......................................................................................................................343 18.4.1.2 Array forms ..................................................................................................................................345 18.4.1.3 Placement forms ..........................................................................................................................345 18.4.2 Storage allocation errors .................................................................................................................346 18.4.2.1 Class bad_alloc......................................................................................................................346 18.4.2.2 Type new_handler..................................................................................................................347
1S01EC148822003E) 18.4.2.3 set_nev_handler 347 18.5 Type identification. 347 18.5.1 Class type_info 347 18.52 Class bad cast... 348 18.3.3 Class bad_typeid. 349 18.6 Exception handling.. 349 18.6.1 Class exception.. 349 18.6.2 Violating creepnon-spreyficanons 350 18.6.2.1 Class bad exception 350 18.6.2.2 Type unexpected handler 351 18.62.3 set_unexpected 351 18.6.2.4 unexpected...... 351 18.6.3 Abnormal termination. 351 18.6.3.1 Type terninate_handler 351 18.6.32 set terninate 352 18.6.3.3 terninate... 352 18.6.4 uncaught_exception 352 18.7 Other runtime support. 352 19 Diagnostics library 355 19.1 Exception classes 355 19.1.1 Class logie_error. 355 19.1.2 Class domain error 356 19.1.3 Class invalid argunent 356 19.1.4 Class longth error 356 19.1.5 Class out of range 4444444444444444444444 357 19.1.6 Class runtime error 357 19.1.7 Class range arror. 357 19.1.8 Class ovarflow arror 357 19.1.9 Class underflow_error 358 358 19.3 Error numbers. 358 20 General utilities library 359 20.1 Requirements 359 20.1.1 Equality comparson 359 20.1.2 Less than commparison 359 20.1.3 Copy construction... 360 20.14 Default construction 360 20.1.5 Allocator requirements 360 20.2 Utility components. 363 20.2.1 Operators........... 364 20.22 Pairs 364 20.3 Function objects 365 20.3.1B% 367 ●50NEC200g-A相phts neserved
ISO/IEC 14882:2003(E) xiv © ISO/IEC 2003 — All rights reserved 18.4.2.3 set_new_handler .................................................................................................................347 18.5 Type identification .............................................................................................................................347 18.5.1 Class type_info.........................................................................................................................347 18.5.2 Class bad_cast ...........................................................................................................................348 18.5.3 Class bad_typeid.......................................................................................................................349 18.6 Exception handling ............................................................................................................................349 18.6.1 Class exception.........................................................................................................................349 18.6.2 Violating exception-specifications..................................................................................................350 18.6.2.1 Class bad_exception ............................................................................................................350 18.6.2.2 Type unexpected_handler.................................................................................................351 18.6.2.3 set_unexpected....................................................................................................................351 18.6.2.4 unexpected .............................................................................................................................351 18.6.3 Abnormal termination .....................................................................................................................351 18.6.3.1 Type terminate_handler ...................................................................................................351 18.6.3.2 set_terminate ......................................................................................................................352 18.6.3.3 terminate................................................................................................................................352 18.6.4 uncaught_exception.............................................................................................................352 18.7 Other runtime support ........................................................................................................................352 19 Diagnostics library ................................................................................................................................355 19.1 Exception classes ...............................................................................................................................355 19.1.1 Class logic_error ....................................................................................................................355 19.1.2 Class domain_error..................................................................................................................356 19.1.3 Class invalid_argument ........................................................................................................356 19.1.4 Class length_error..................................................................................................................356 19.1.5 Class out_of_range..................................................................................................................357 19.1.6 Class runtime_error ...............................................................................................................357 19.1.7 Class range_error ....................................................................................................................357 19.1.8 Class overflow_error.............................................................................................................357 19.1.9 Class underflow_error...........................................................................................................358 19.2 Assertions ..........................................................................................................................................358 19.3 Error numbers ....................................................................................................................................358 20 General utilities library .........................................................................................................................359 20.1 Requirements .....................................................................................................................................359 20.1.1 Equality comparison .......................................................................................................................359 20.1.2 Less than comparison .....................................................................................................................359 20.1.3 Copy construction ...........................................................................................................................360 20.1.4 Default construction........................................................................................................................360 20.1.5 Allocator requirements ...................................................................................................................360 20.2 Utility components.............................................................................................................................363 20.2.1 Operators.........................................................................................................................................364 20.2.2 Pairs ................................................................................................................................................364 20.3 Function objects .................................................................................................................................365 20.3.1 Base.................................................................................................................................................367
1S01EC14882:2003(曰 20.3 2 Arithmetic operations 367 2033 Comparisons 368 20 3.4 Logical operations 369 2035 Negators. 369 2036 Binders. 4370 20 3.6.I Claess template binder1st ........... .370 20362 bindlst. 370 20.3.6 3 Class template binder2nd........... .370 20364 bind2nd 371 203.7 Adaptors for poimters to functions..... 37 2038 Adapors for pointers to members...... 372 20.4 Memory 374 20.4.1 The default allocacor 374 204.1.1 allocator members 4444444444444444 20.4.12 allocator globals. 376 20.4 2 Raw storage iteror 376 2043 Temporary buffers 377 20.4.4 Specialined algorithms. 377 2044.1 uninitialized copy 377 20442 uninitfaliged_fill... 4378 20443 uninitialized_fill_n 378 20.4 5 Class template auto ptr...... 378 20.4 5.1 auto ptr constructors. 379 204 52 auto ptr members. 379 20.4 53 auto ptr conversions 380 2046 CLihrary 380 20_5 Dale and time 381 21 Strings libeary a4383 21.1 Character traits. 383 21.1.1 Character traits requirements. .383 21.12 traits typedefs. 385 21.13 char_traits specializations..... 385 21.13.1 struet char_traitscehar>. 38S 21.132 struet char traitacwchar t> .386 212 String casses 387 213 Class template basic_string. 389 213.1 basic_string constructors. .393 2132 basie_atring itermtor support. 59% 2133 basic string capucity.......... 396 213.4 basic string element access....... 398 2135 baaie atring modifiers .398 21351 basie_atring::operator+- 398 21352 basic string::append........ 398 21353 basie atring::assign...... 399 21354 basic_string::insert 400 21355 basic string::erase................ 401 21356 basic_string:replace.... 401 2135.7 basie_atring::copy... ,402 ISOnEC 2003-All rights reserved XV
ISO/IEC 14882:2003(E) © ISO/IEC 2003 — All rights reserved xv 20.3.2 Arithmetic operations .....................................................................................................................367 20.3.3 Comparisons ...................................................................................................................................368 20.3.4 Logical operations ..........................................................................................................................369 20.3.5 Negators ..........................................................................................................................................369 20.3.6 Binders ............................................................................................................................................370 20.3.6.1 Class template binder1st .......................................................................................................370 20.3.6.2 bind1st.....................................................................................................................................370 20.3.6.3 Class template binder2nd .......................................................................................................370 20.3.6.4 bind2nd.....................................................................................................................................371 20.3.7 Adaptors for pointers to functions ..................................................................................................371 20.3.8 Adaptors for pointers to members ..................................................................................................372 20.4 Memory..............................................................................................................................................374 20.4.1 The default allocator .......................................................................................................................374 20.4.1.1 allocator members ................................................................................................................375 20.4.1.2 allocator globals ...................................................................................................................376 20.4.2 Raw storage iterator ........................................................................................................................376 20.4.3 Temporary buffers ..........................................................................................................................377 20.4.4 Specialized algorithms ....................................................................................................................377 20.4.4.1 uninitialized_copy..........................................................................................................377 20.4.4.2 uninitialized_fill..........................................................................................................378 20.4.4.3 uninitialized_fill_n .....................................................................................................378 20.4.5 Class template auto_ptr.............................................................................................................378 20.4.5.1 auto_ptr constructors..............................................................................................................379 20.4.5.2 auto_ptr members ..................................................................................................................379 20.4.5.3 auto_ptr conversions ..............................................................................................................380 20.4.6 C Library .........................................................................................................................................380 20.5 Date and time .....................................................................................................................................381 21 Strings library .......................................................................................................................................383 21.1 Character traits ...................................................................................................................................383 21.1.1 Character traits requirements ..........................................................................................................383 21.1.2 traits typedefs ..................................................................................................................................385 21.1.3 char_traits specializations .....................................................................................................385 21.1.3.1 struct char_traits<char>............................................................................................385 21.1.3.2 struct char_traits<wchar_t>.....................................................................................386 21.2 String classes .....................................................................................................................................387 21.3 Class template basic_string......................................................................................................389 21.3.1 basic_string constructors .......................................................................................................393 21.3.2 basic_string iterator support ..................................................................................................396 21.3.3 basic_string capacity .............................................................................................................396 21.3.4 basic_string element access ...................................................................................................398 21.3.5 basic_string modifiers ...........................................................................................................398 21.3.5.1 basic_string::operator+=............................................................................................398 21.3.5.2 basic_string::append .....................................................................................................398 21.3.5.3 basic_string::assign .....................................................................................................399 21.3.5.4 basic_string::insert .....................................................................................................400 21.3.5.5 basic_string::erase........................................................................................................401 21.3.5.6 basic_string::replace...................................................................................................401 21.3.5.7 basic_string::copy ..........................................................................................................402
1S01EC148822003E) 21.3.5.8 basic_string:swap 403 21.3.6 basic_string string operations. 403 21.36.1 basic string::find 403 21.3.6.2 basic_string::rfind 40N 21.3.6.3 baste string:tind first of 404 21.3.6.4 basic_string:find_last_of......... 405 21.3.6.5 basic_string:find_first_not_of 405 21.3.6.6 basic_string::find_last_not_of 406 21.36.7 basle string:substr. 406 21.3.6.8 basic_stringt icompare... 406 21.3.7 basic_string non-member functions. 407 21.3.7.1 operator+... 407 21.3.72 operator 408 21.3.73 operator!. 408 21.3.74 operator《 409 21.3.7.5 operator>. 409 21.3.7.6 operatorca 409 21.3.7.7 operator> 410 21.3.78 410 21.3.7.9 Inserters and extractors 410 21.4 Null-terminaled sequence utilities 411 22 Localization library 415 22.1L0caes..… 4l5 22.1.1 Class lecale 416 22.1.1.110ca10pes 418 22.1.1.1.1 Type locale::category 418 22.1.1.1.2 Class locale::facet 420 22.1.113C1ass10ca1e::1d 420 22.1.1.2 locale constructors and destructor. 421 22.1.1.3 locale members 422 22.1.14 locale operators. 422 22.1.1.$leeale state members 423 22.1.2 locale globals... 423 22.1.3 Convenience interfaces 423 22.1.3.1 Character classification 423 22.1.32 Character conversions 424 22.2 Standard locale caegories 424 22.2.1 The ctype calepory. 424 22.2.1.1 Class templa ctype 424 22.2.1.1.1 ctype members.... 425 22.2.1.12 ctype virtual functions 426 22.2.1.2 Class templace ctype_byname 427 22.2.1.3 ctype specializations. 428 22.2.1.3.1 ctypecchar>destructor. 429 222.132 ctypecchar>members 429 222.1.3.3 ctype<char>static members 430 22.2.1.34 etypecehar>virtual functions.. 430 22.2.1.4 Class ctype_bynamecchar> 431 22.2.1.5 Class templae codecvt 431 22.2.1.5.1 codecvt members 432 SOEC 2003-Al rights neserved
ISO/IEC 14882:2003(E) xvi © ISO/IEC 2003 — All rights reserved 21.3.5.8 basic_string::swap..........................................................................................................403 21.3.6 basic_string string operations ................................................................................................403 21.3.6.1 basic_string::find..........................................................................................................403 21.3.6.2 basic_string::rfind........................................................................................................404 21.3.6.3 basic_string::find_first_of.....................................................................................404 21.3.6.4 basic_string::find_last_of.......................................................................................405 21.3.6.5 basic_string::find_first_not_of...........................................................................405 21.3.6.6 basic_string::find_last_not_of .............................................................................406 21.3.6.7 basic_string::substr .....................................................................................................406 21.3.6.8 basic_string::compare...................................................................................................406 21.3.7 basic_string non-member functions ......................................................................................407 21.3.7.1 operator+................................................................................................................................407 21.3.7.2 operator== .............................................................................................................................408 21.3.7.3 operator!= .............................................................................................................................408 21.3.7.4 operator<................................................................................................................................409 21.3.7.5 operator>................................................................................................................................409 21.3.7.6 operator<= .............................................................................................................................409 21.3.7.7 operator>= .............................................................................................................................410 21.3.7.8 swap............................................................................................................................................410 21.3.7.9 Inserters and extractors ................................................................................................................410 21.4 Null-terminated sequence utilities .....................................................................................................411 22 Localization library ...............................................................................................................................415 22.1 Locales ...............................................................................................................................................415 22.1.1 Class locale ................................................................................................................................416 22.1.1.1 locale types .............................................................................................................................418 22.1.1.1.1 Type locale::category...................................................................................................418 22.1.1.1.2 Class locale::facet .........................................................................................................420 22.1.1.1.3 Class locale::id.................................................................................................................420 22.1.1.2 locale constructors and destructor ...........................................................................................421 22.1.1.3 locale members .......................................................................................................................422 22.1.1.4 locale operators .......................................................................................................................422 22.1.1.5 locale static members ..............................................................................................................423 22.1.2 locale globals .............................................................................................................................423 22.1.3 Convenience interfaces ...................................................................................................................423 22.1.3.1 Character classification ................................................................................................................423 22.1.3.2 Character conversions ..................................................................................................................424 22.2 Standard locale categories.............................................................................................................424 22.2.1 The ctype category ......................................................................................................................424 22.2.1.1 Class template ctype.................................................................................................................424 22.2.1.1.1 ctype members .......................................................................................................................425 22.2.1.1.2 ctype virtual functions ...........................................................................................................426 22.2.1.2 Class template ctype_byname................................................................................................427 22.2.1.3 ctype specializations .................................................................................................................428 22.2.1.3.1 ctype<char> destructor .......................................................................................................429 22.2.1.3.2 ctype<char> members ........................................................................................................429 22.2.1.3.3 ctype<char> static members ...............................................................................................430 22.2.1.3.4 ctype<char> virtual functions.............................................................................................430 22.2.1.4 Class ctype_byname<char> .........................................................................................................431 22.2.1.5 Class template codecvt............................................................................................................431 22.2.1.5.1 codecvt members ..................................................................................................................432