SGI-STL abbreviated (five) - Tools, Miscellaneous resolved

Utility: 
stl_relops.h: 
    internal template provides overloaded operator =,! operator >, operator <=, operator > =, while the use of these functions within the template to the operator == and operator <; it only needs to support the template parameter T operator == and operator < , 
    can support other comparison operators, rather than have a heavy load; 
    
stl_pair.h: 
    pair struct template class, only provide two constructors, a default constructor, and the other is followed by initialization parameters member variables first, second; but also implies a template parameter type T to be implicit or explicit support assignment constructor; 
    in addition a number of overloaded comparison operators, as well as a tool to construct a pair of make_pair function; 
    
stl_tempbuf.h: 
    temporary buffer template class, function; 
    get_temporary_buffer: obtaining a temporary buffer, called internally __get_temporary_buffer implemented; len parameters ptrdiff_t, T *, where T * only as a type identifier may be unnecessary; return type pair <T *, ptrdiff_t> where T * is a 
    request to the address space, the second parameter is the actual size of the space allocated to; You may apply for large size INT_MAX / sizeof(T); application strategy: first adjust the size of the application and the application needs space size (internal application by malloc), if it fails 
    to re-apply by half, and so on until the application is successful or failed so far; 
    
    return_temporary_buffer: application to return before the release of the memory space (immediate release free call) (i.e., a member of the first pair); 
    
    _Temporary_buffer: temporary buffer template class, the template parameter < class _ForwardIterator, class T> , i.e. to provide at least a forward iterator and data types, data members _ M_original_len original length, _M_len to apply to the buffer length, 
    _M_buffer of application buffer to the first address; 
    constructor parameter iterator range, the internal distance acquired call to initialize the iterator length range _M_len, after performing call _M_allocate_buffer the actual application buffer operation, call _M_initialize_buffer initialize the buffer; 
    if abnormal or application initialization process occurs, the release buffer application is successful; 
    _M_allocate_buffer: __get_temporary_buffer implementation mechanism and the same, _M_original_len save the original iterator Circumference length;  
    _M_initialize_buffer: buffer initialization overloaded version, depending on whether the iterator type requires __true_type built POD type or implicit default constructor, if this is not a need to use the first value and call uninitialized_fill_n iterator initialized;
    internal call destroy destruction destructor each application for each object in the buffer, then call free to release the buffer; 
    size: size of the buffer to access applications; 
    requested_size: obtaining the requested buffer size;
    begin, end: acquiring first address buffer and a tail buffer address (such as a new range iterator); 
    
    different _Temporary_buffer the get_temporary_buffer that the former encapsulating the latter function and provide more user interface, in addition to the former by an iterative an application range and a buffer size by the iterator value to initialize the first buffer; 
    
    temporary_buffer: simply inherited _Temporary_buffer, no increase in other operations, is generally used directly to an external class;

 

Guess you like

Origin www.cnblogs.com/haomiao/p/11647219.html