std:: modulus<void>
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Old binders and adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
헤더 파일에 정의됨
<functional>
|
||
|
template
<>
class modulus < void > ; |
(C++14부터) | |
std:: modulus < void > 는 매개변수와 반환 타입이 추론된 std::modulus 의 특수화입니다.
목차 |
중첩 타입
| 중첩 타입 | 정의 |
is_transparent
|
unspecified |
멤버 함수
|
operator()
|
두 인자의 modulus를 반환합니다
(public member function) |
std::modulus<void>:: operator()
|
template
<
class
T,
class
U
>
constexpr
auto
operator
(
)
(
T
&&
lhs, U
&&
rhs
)
const
|
||
lhs 를 rhs 로 나눈 나머지를 반환합니다.
매개변수
| lhs, rhs | - | 나눌 값들 |
반환 값
std:: forward < T > ( lhs ) % std:: forward < U > ( rhs ) .
예제
#include <functional> #include <iostream> struct M { M(int x) { std::cout << "M(" << x << ");\n"; } M() {} }; auto operator%(M, M) { std::cout << "operator%(M, M);\n"; return M{}; } auto operator%(M, int) { std::cout << "operator%(M, int);\n"; return M{}; } auto operator%(int, M) { std::cout << "operator%(int, M);\n"; return M{}; } int main() { M m; // 42는 임시 객체 M{42}로 변환됨 std::modulus<M>{}(m, 42); // operator%(M, M) 호출 // 임시 객체 없음 std::modulus<void>{}(m, 42); // operator%(M, int) 호출 std::modulus<void>{}(42, m); // operator%(int, M) 호출 }
출력:
M(42); operator%(M, M); operator%(M, int); operator%(int, M);