Can I create an assumption that
std :: string str; ... /
Do something for the following statement is always true?
(str.empty () == (str == ""))
Answer
Yes, the implementation is relevant to bits / basic_string.h
, basic_string & lt; _CharT, _Traits, _Alloc & gt; Code for
:
discussion
Although two forms are equivalent to std :: string
, you May be to use <.> .empty () because it is more common.
In fact, the comment is that if you type std: :
, then Std :: string
instead of wstring == ""
will also not be compiled, because you have the wchar_t
You can not compare a string with > four
. However, this is not directly relevant to your basic question, and I'm 99% sure that you do not have std :: wstring
Comments
Post a Comment