HasInequivalence.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <type_traits>
7 
8 namespace tt {
9 // @{
10 /// \ingroup TypeTraitsGroup
11 /// \brief Check if type `T` has operator!= defined.
12 ///
13 /// \details
14 /// Inherits from std::true_type if the type `T` has operator!= defined,
15 /// otherwise inherits from std::false_type
16 ///
17 /// \usage
18 /// For any type `T`,
19 /// \code
20 /// using result = tt::has_inequivalence<T>;
21 /// \endcode
22 ///
23 /// \metareturns
24 /// std::bool_constant
25 ///
26 /// \semantics
27 /// If the type `T` has operator!= defined, then
28 /// \code
29 /// typename result::type = std::true_type;
30 /// \endcode
31 /// otherwise
32 /// \code
33 /// typename result::type = std::false_type;
34 /// \endcode
35 ///
36 /// \example
37 /// \snippet Test_HasInequivalence.cpp has_inequivalence_example
38 /// \see has_equivalence
39 /// \tparam T the type we want to know if it has operator!=
40 template <typename T, typename U = void>
42 
43 /// \cond HIDDEN_SYMBOLS
44 template <typename T>
45 struct has_inequivalence<
46  T, std::void_t<decltype(std::declval<T>() != std::declval<T>())>>
47  : std::true_type {};
48 /// \endcond
49 
50 /// \see has_inequivalence
51 template <typename T>
53 
54 /// \see has_inequivalence
55 template <typename T>
57 // @}
58 } // namespace tt
tt::has_inequivalence_t
typename has_inequivalence< T >::type has_inequivalence_t
Definition: HasInequivalence.hpp:56
std::false_type
tt::has_inequivalence
Check if type T has operator!= defined.
Definition: HasInequivalence.hpp:41
tt::has_inequivalence_v
constexpr bool has_inequivalence_v
Definition: HasInequivalence.hpp:52
tt
Definition: TensorExpression.hpp:113
type_traits