std::string::npos

来源:互联网 发布:创建视图的sql语句代码 编辑:程序博客网 时间:2024/05/01 08:43
保存,以便以后查看!static const size_t npos = -1;
Maximum value(最大值) for size_t
npos is a static member constant value with the greatest possible value for an element of typesize_t.

This value, when used as the value for a count parameter n in string's member functions, roughly indicates"as many as possible".

When used in some pos parameters that allow for out-of-range values, npos indicates the end of the string.

As a return value it is usually used to indicate failure.

This constant is actually defined with a value of -1 (for any trait), which becausesize_t is an unsigned integral type, becomes the largest possible representable value for this type.


来自c++API文档

0 0
原创粉丝点击