“cpp/string/char traits/find”的版本间的差异

来自cppreference.com
< cpp‎ | string‎ | char traits
返回值: NULL => 空指针
第2行: 第2行:
 
{{cpp/string/char_traits/navbar}}
 
{{cpp/string/char_traits/navbar}}
 
{{dcl begin}}
 
{{dcl begin}}
{{dcl rev begin}}
+
{{dcl rev | =c++17
{{dcl | until=c++17|  
+
|
 
static const char_type* find( const char_type* p, std::size_t count, const char_type& ch );
 
static const char_type* find( const char_type* p, std::size_t count, const char_type& ch );
}}
+
| =
{{dcl | since=c++17|
+
 
static constexpr const char_type* find( const char_type* p, std::size_t count, const char_type& ch );
 
static constexpr const char_type* find( const char_type* p, std::size_t count, const char_type& ch );
 
}}
 
}}
{{dcl rev end}}
 
 
{{dcl end}}
 
{{dcl end}}
  

2020年6月17日 (三) 10:18的版本


static const char_type* find( const char_type* p, std::size_t count, const char_type& ch );
(C++17 前)
static constexpr const char_type* find( const char_type* p, std::size_t count, const char_type& ch );
(C++17 起)

p 所指字符序列的前 count 个字符中查找字符 ch

目录

参数

p - 指向要查找的字符串的指针
count - 要分析的字符数量
ch - 要查找的字符

返回值

指向 [p, p + count) 所指定范围中首个比较等于 ch 的字符的指针,或若未找到则为空指针。

异常

(无)

复杂度

count 成线性。