CHString::operator+
[The CHString class is part of the WMI Provider Framework which is now considered in final state, and no further development, enhancements, or updates will be available for non-security related issues affecting these libraries. The MI APIs should be used for all new development.]
The + concatenation operator joins two strings and returns a CHString object.
friend CHString operator +(
const CHString& str1,
const CHString& str2 )
throw( CHeap_Exception );
friend CHString operator +(
const CHString& str,
WCHAR ch )
throw( CHeap_Exception );
friend CHString operator +(
WCHAR ch,
const CHString& str )
throw( CHeap_Exception );
friend CHString operator +(
const CHString& str,
LPCWSTR lpsz )
throw( CHeap_Exception );
friend CHString operator +(
LPCWSTR lpsz,
const CHString& str )
throw( CHeap_Exception );
friend CHString operator +(
const CHString& str,
char ch )
throw( CHeap_Exception );
friend CHString operator +(
char ch,
const CHString& str )
throw( CHeap_Exception );
Parameters
-
str, str1, str2
-
CHString strings that are concatenated.
-
ch
-
A character that concatenates to a string or a string that concatenates to a character.
-
lpsz
-
Pointer to a NULL-terminated character string.
Return Values
This concatenation operator returns a CHString object that is the temporary result of the concatenation. This return value makes it possible to combine several concatenations in the same expression.
Remarks
One of the two argument strings must be a CHString object; the other can be a character pointer or a character. Be aware that memory exceptions can occur whenever you use the concatenation operator because new storage may be allocated to hold temporary data.
Examples
The following code example shows the use of CHString::operator +:
CHString s1( L"abc" );
CHString s2( L"def" );
assert( (s1 + s2 ) == L"abcdef" );
CHString s3;
s3 = CHString( L"abc" ) + "def" ; // Correct
s3 = "abc" + "def"; // Wrong. The first argument must be a CHString.
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows Vista |
Minimum supported server |
Windows Server 2008 |
Header |
|
Library |
|
DLL |
|