Namespaces
Variants

std:: ratio_not_equal

From cppreference.net
Metaprogramming library
Type traits
Type categories
(C++11)
(C++11) ( DR* )
Type properties
(C++11)
(C++11)
(C++14)
(C++11) (deprecated in C++26)
(C++11) ( until C++20* )
(C++11) (deprecated in C++20)
(C++11)
Type trait constants
Metafunctions
(C++17)
Supported operations
Relationships and property queries
Type modifications
Type transformations
(C++11) (deprecated in C++23)
(C++11) (deprecated in C++23)
(C++11)
(C++11) ( until C++20* ) (C++17)

Compile-time rational arithmetic
Compile-time integer sequences
헤더에 정의됨 <ratio>
template < class R1, class R2 >
struct ratio_not_equal : std:: integral_constant < bool , /* see below */ > { } ;
(C++11부터)

비율 R1 R2 가 같지 않으면, 멤버 상수 value true 와 같도록 제공합니다. 그렇지 않으면, value false 입니다.

목차

헬퍼 변수 템플릿

template < class R1, class R2 >
constexpr bool ratio_not_equal_v = ratio_not_equal < R1, R2 > :: value ;
(C++17 이후)

std:: integral_constant 로부터 상속됨

멤버 상수

value
[static]
true 만약 R1 :: num ! = R2 :: num || R1 :: den ! = R2 :: den 인 경우, false 그렇지 않은 경우
(public static member constant)

멤버 함수

operator bool
객체를 bool 로 변환, value 반환
(public member function)
operator()
(C++14)
value 반환
(public member function)

멤버 타입

타입 정의
value_type bool
type std:: integral_constant < bool , value >

가능한 구현

template< class R1, class R2 >
struct ratio_not_equal : std::integral_constant <
                              bool,
                              !std::ratio_equal<R1, R2>
                         > {};

예제

#include <ratio>
static_assert(std::ratio_not_equal_v<std::ratio<6, 9>, std::ratio<9, 6>>, "6/9 != 9/6");
int main() {}

참고 항목

컴파일 타임에 두 ratio 객체의 동등성을 비교
(클래스 템플릿)