SGI-STL abbreviated (nine) - string (string / wstring)

char_traits.h: 
    __char_traits_base: character characteristic template base classes: 
        internal char_type weight declared character type, the type Integer INT_TYPE; 
        furthermore provides a plurality of static member functions, such as: 
        ASSIGN: assignment function, the content of the source character to a target character assigned; there is also a heavy-duty version, which will be assigned to a character string buffer specified length n, i.e., n times the assignment (Note that the target buffer size can not be less than n); 
        EQ: equal comparison function to compare two character parameters content equal returns true, otherwise to false; 
        lt: less than the comparison function, if the parameter is less than the left and right argument returns true, otherwise to false; 
        Compare: comparison function, a string comparison and the comparison string length n (two comparative is not smaller than the length of the string n, or may throw an exception); loop for sequentially comparing the index of each character string, returns true if both are equal, if the former is smaller than the latter returns - . 1 , otherwise. 1; 
        length; Get string length, the internal structure which practices a __nullchar, and in turn to the respective character strings to be compared Comparative eq call, until the call returns true date (with a proviso that the character string must be end to end, or may exception), this time length is the total length of the string; 
        Find: find whether there is a specified string length n a character c, followed by internal lookup call for each eq whether the character string comparisons and find the equivalent character c, if the first address to find where the character string is returned, otherwise returns 0 (n can not be greater than the length of the string) ; 
        Move: a specified length of the copy to the target character buffer where the string, to achieve an internal call memmove copy (which can ensure that when the source and the target area if there is an overlap may be safely and properly process) (Note that the destination buffer must be large enough, i.e., greater than or equal to the source character buffer string specified size);
        copy: similar move, the internal memory copy call memcopy achieved by memcpy memmove differs, so the former when the source and destination buffers possible abnormal overlap, while the latter may be safe, correct handling; 
        EOF: End returns identification, internal returns static_cast <INT_TYPE> (- . 1 ); 
        eq_int_type: Comparative INT_TYPE two types of characters are equal, it returns true if equal, otherwise to false; 
        to_int_type: converting char_type type INT_TYPE type internal static_cast <INT_TYPE> conversion; 
        to_char_type: the int_type char_type type to type, internal static_cast <char_type> conversion; 
        not_eof: determining whether the specified value is not int_type end identification, and call eq_int_type internal structure eof comparison therewith, when the completion flag is 0 is returned, otherwise the parameter value; 
    
    char_traits: template class character properties, inherited from __char_traits_base; specializations char_traits currently available < char >>, Char_traits <wchar_t> ; 
    
    char_traits < char : char character characteristic Laid-type version, supplied to __char_traits_base int_type integer type in an int; In addition to static function in the base class, the current class is also partly achieved rewritten; 
        to_char_type : the int type to char type, internal static_cast < char > (static_cast <unsigned char > (C)) converter, i.e. converted first unsigned char, and then converted to the character type; 
        to_int_type: the char type to type int , internal static_cast <unsigned char > (C) conversion, i.e. converted to an unsigned character type character type, and then converted to compatible int; 
        Compare: comparison function, no by-character comparison, but internal call memcmp implemented to improve efficiency ; 
        length: Get string length, string internal calls strlen C acquired, to improve efficiency; 
        aSSIGN: rewriting overloaded with two versions, one for the character assigned to the buffer specified version string of length n, the internal calling memset achieve to improve efficiency; 
        
    char_traits <wchar_t> : character characteristic wide character specializations provide __char_traits_base integer type int_type wint_t, which are using the base class implementation; 

stl_ctraits_fns.h: 
    main character type class encapsulates characteristics of an object to realize a function, primarily for the associated operation of the string algorithm; 
    _Eq_traits: characters equal characteristic function object template class, inherited from binary_function; inside its overloaded operator () call template parameters eq achieve equality comparison; 
    _Eq_int_traits: integer equal to the characteristic function object template class, inherited from binary_function; template parameters are char_type, INT_TYPE, inside which overloaded operator () is first called after char_type transformed by to_int_type template parameters eq_int_type achieve equality comparison; 
    _Lt_traits: template characters smaller than the comparison function object class inherits a binary_function; the weight contained operator () is called internally template parameters to achieve smaller than the comparison lt; 

stl_string_fwd.h:     
    forward basic_string template class declaration, the declaration both basic_string < char > and basic_string <wchar_t> are string, wstring types, direct and convenient externally use of string Or wstring; 
    in addition __get_c_string static function to obtain C-style format string string, which is called internally string of c_str interfaces; 
        
string :
    _Not_within_traits: Template function object character properties, inherited from unary_function;  
    its member variables _M_first, _M_last initialized in its constructor, to save the address of the string end to end of the current will find;
    member function operator () to find the specified character string in a given range _M_first, within _M_last, returns true if it exists, otherwise return false; it is called internally find_if Find ; find_if Furthermore, in order to support the predicate function, using left binding _Eq_traits bind1st as a predicate function; 
    
    _String_alloc_base: string base class assigned templates; template parameter data type T, respectively, dispenser type _Allocator, and a bool identification _IsStatic ( criteria for distinguishing whether the dispenser or dispenser SGI); 
    data member: 
        _M_data_allocator: allocator object; 
        :; _M_start application stored first address buffer (equivalent to the first address of the container element) 
        when the length of the holding vessel contents: _M_finish end address; 
        _M_end_of_storage: save the application end of the buffer address; 
    member function: 
        constructors: allocator_type type dispenser to initialize the reference _M_data_allocator; 
        get_allocator: obtaining an object dispenser _M_data_allocator; 
        _M_allocate: Object dispenser by _M_data_ allocator allocation size is n type size of the memory element; 
        _M_deallocate: releases the specified data element type pointer address data elements of size n type size of memory space;
    It also offers specialized version _String_alloc_base <_TP, _Allocator, to true  >, the interior of the dispensing base class template objects no longer used dispenser, but directly using the static member functions are allocated simple_alloc management; 
    
    _String_base: string base class inherits _String_alloc_base, template parameters _IsStatic its base class is initialized by extraction _S_instanceless _Alloc_traits obtained; 
        constructors: overloaded version, one kind of object initialization by the allocator type; also adds another parameter n, internal call _M_allocate to n-byte buffer pre-allocated and adjusting _M_start, _M_finish, _M_end_of_storage value; 
        destructor: call _M_deallocate_block release the current buffer;    

 

Guess you like

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