operator+ (<string>)
두 string 개체를 연결합니다.
template<class CharType, class Traits, class Allocator>
basic_string<CharType, Traits, Allocator> operator+(
const basic_string<CharType, Traits, Allocator>& _Left,
const basic_string<CharType, Traits, Allocator>& _Right
);
template<class CharType, class Traits, class Allocator>
basic_string<CharType, Traits, Allocator> operator+(
const basic_string<CharType, Traits, Allocator>& _Left,
const CharType* _Right
);
template<class CharType, class Traits, class Allocator>
basic_string<CharType, Traits, Allocator> operator+(
const basic_string<CharType, Traits, Allocator>& _Left,
const CharType _Right
);
template<class CharType, class Traits, class Allocator>
basic_string<CharType, Traits, Allocator> operator+(
const CharType* _Left,
const basic_string<CharType, Traits, Allocator>& _Right
);
template<class CharType, class Traits, class Allocator>
basic_string<CharType, Traits, Allocator> operator+(
const CharType _Left,
const basic_string<CharType, Traits, Allocator>& _Right
);
template<class CharType, class Traits, class Allocator>
basic_string<CharType, Traits, Allocator>&& operator+(
const basic_string<CharType, Traits, Allocator>& _Left,
const basic_string<CharType, Traits, Allocator>&& _Right
);
template<class CharType, class Traits, class Allocator>
basic_string<CharType, Traits, Allocator>&& operator+(
const basic_string<CharType, Traits, Allocator>&& _Left,
const basic_string<CharType, Traits, Allocator>& _Right
);
template<class CharType, class Traits, class Allocator>
basic_string<CharType, Traits, Allocator>&& operator+(
const basic_string<CharType, Traits, Allocator>&& _Left,
const basic_string<CharType, Traits, Allocator>&& _Right
);
template<class CharType, class Traits, class Allocator>
basic_string<CharType, Traits, Allocator>&& operator+(
const basic_string<CharType, Traits, Allocator>&& _Left,
const CharType *_Right
);
template<class CharType, class Traits, class Allocator>
basic_string<CharType, Traits, Allocator>&& operator+(
const basic_string<CharType, Traits, Allocator>&& _Left,
CharType _Right
);
template<class CharType, class Traits, class Allocator>
basic_string<CharType, Traits, Allocator>&& operator+(
const CharType *_Left,
const basic_string<CharType, Traits, Allocator>&& _Right
);
template<class CharType, class Traits, class Allocator>
basic_string<CharType, Traits, Allocator>&& operator+(
CharType _Left,
const basic_string<CharType, Traits, Allocator>&& _Right
);
매개 변수
_Left
C 스타일 문자열 형식의 개체 또는 basic_string 연결 될 수 있습니다._Right
C 스타일 문자열 형식의 개체 또는 basic_string 연결 될 수 있습니다.
반환 값
입력된 문자열의 연결 문자열입니다.
설명
각 함수를 오버 로드 operator+ 템플릿 클래스의 두 개체를 연결 하 여 basic_string Class.효과적으로 모든 반환 basic_string<CharType, 성분, 할당자> (_왼쪽).append(_Right).
예제
// string_op_con.cpp
// compile with: /EHsc
#include <string>
#include <iostream>
int main( )
{
using namespace std;
// Declaring an object of type basic_string<char>
string s1 ( "anti" );
string s2 ( "gravity" );
cout << "The basic_string s1 = " << s1 << "." << endl;
cout << "The basic_string s2 = " << s2 << "." << endl;
// Declaring a C-style string
char *s3 = "heroine";
cout << "The C-style string s3 = " << s3 << "." << endl;
// Declaring a character constant
char c1 = '!';
cout << "The character constant c1 = " << c1 << "." << endl;
// First member function: concatenates an object
// of type basic_string with an object of type basic_string
string s12 = s1 + s2;
cout << "The string concatenating s1 & s2 is: " << s12 << endl;
// Second & fourth member functions: concatenate an object
// of type basic_string with an object of C-syle string type
string s1s3 = s1 + s3;
cout << "The string concatenating s1 & s3 is: " << s1s3 << endl;
// Third & fifth member functions: concatenate an object
// of type basic_string with a character constant
string s1s3c1 = s1s3 + c1;
cout << "The string concatenating s1 & s3 is: " << s1s3c1 << endl;
}
요구 사항
헤더: <string>
네임 스페이스: 국방 표준