这两天再看C++标准string这部分,看到find的时候,对
size _ type find( const value _ type* _Ptr , size _ type _Off = 0, size _ type _Count ) const;
第三个参数看得很糊涂,偶的英文太差了。
MSDN上说是 :
_Count
The number of characters, counting forward from the first character, in the C-string for which the member function is to search.
The C++ Standard Library上说是:
These functions search for the first character that is or is not also an element of the chars_len characters of the character array chars (starting at index idx).
看得很糊涂,后来通过自己调试MSDN上的示例代码,我才明白,第三个参数是要比较的字符个数,第三个参数如果<1或是大于 _Ptr的长度,比较就没有意义了,但在1和 _Ptr之间有什么意义的,在什么时候用得到呢,这点还不是太清楚。在网上的很多例子都没有用到这个参数。
size _ type find( const value _ type* _Ptr , size _ type _Off = 0, size _ type _Count ) const;
第三个参数看得很糊涂,偶的英文太差了。
MSDN上说是 :
_Count
The number of characters, counting forward from the first character, in the C-string for which the member function is to search.
The C++ Standard Library上说是:
These functions search for the first character that is or is not also an element of the chars_len characters of the character array chars (starting at index idx).
看得很糊涂,后来通过自己调试MSDN上的示例代码,我才明白,第三个参数是要比较的字符个数,第三个参数如果<1或是大于 _Ptr的长度,比较就没有意义了,但在1和 _Ptr之间有什么意义的,在什么时候用得到呢,这点还不是太清楚。在网上的很多例子都没有用到这个参数。