<QtSwap> 프록시 페이지
함수
void | qSwap(T &lhs, T &rhs) |
함수 문서
[constexpr noexcept(...)]
template <typename T> void qSwap(T &lhs, T &rhs)
유형별 swap()
오버로드를 고려하여 lhs 와 rhs 변수의 값을 교환합니다.
이 함수는 Qt의 boost::swap()
와 동일하며
using std::swap; // bring std::swap into scope (for built-in types) swap(lhs, rhs); // unqualified call (picks up type-specific overloads // via Argument-Dependent Lookup, or falls back to std::swap)
이 함수는 주로 T
에 대해 아무것도 모르기 때문에 일반적으로 위의 두 줄을 작성했을 일반 코드에서 사용합니다.
T
이 무엇인지 이미 알고 있다면 다음 옵션 중 하나를 선호하는 순서대로 사용하십시오:
lhs.swap(rhs);
해당 멤버 스왑이 존재하는 경우std::swap(lhs, rhs);
유형별swap()
이 존재하지 않는 경우
자세한 내용은 boost.org의boost::swap()
을 참조하세요.
cppreference.com의std::swap
, cppreference.com의Swappable
을 참조하세요.
참고: 이 함수는 std::is_nothrow_swappable_v<T>
가 true
인 경우를 제외하고는 작동하지 않습니다.
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.