std::swap
std::swap (std::basic_ospanstream 특수화)
std::swap 알고리즘을 std::basic_ospanstream에 대해 오버로드한 함수예요. 두 출력 스팬 스트림의 상태를 서로 바꿔요. C++23부터 있어요.
출처: cppreference
본문
<spanstream> 헤더에 정의돼 있고, std::basic_ospanstream용 swap 오버로드예요.
template< class CharT, class Traits >
void swap( std::basic_ospanstream<CharT, Traits>& lhs,
std::basic_ospanstream<CharT, Traits>& rhs );
lhs의 상태를 rhs의 상태와 교환해요. 내부적으로 lhs.swap(rhs)를 호출해요.
- 매개변수
lhs,rhs: 상태를 바꿀 스트림들이에요. - 반환 값: 없음.
- 예외: 구현 정의 방식의 예외를 던질 수 있어요.
std::basic_ospanstream은 고정 크기 스팬(span)을 출력 스트림처럼 다루는 클래스예요. 이 swap 오버로드 덕분에 일반화된 코드에서도 두 스트림의 상태를 쉽게 교환할 수 있어요. 예제 섹션은 아직 미완성으로 표시돼 있어요.