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 #include "Utilities/TypeTraits.hpp"
9 
10 namespace tt {
11 // @{
12 /// \ingroup TypeTraitsGroup
13 /// \brief Check if type `T` has operator!= defined.
14 ///
15 /// \details
16 /// Inherits from std::true_type if the type `T` has operator!= defined,
17 /// otherwise inherits from std::false_type
18 ///
19 /// \usage
20 /// For any type `T`,
21 /// \code
22 /// using result = tt::has_inequivalence<T>;
23 /// \endcode
24 ///
25 /// \metareturns
26 /// cpp17::bool_constant
27 ///
28 /// \semantics
29 /// If the type `T` has operator!= defined, then
30 /// \code
31 /// typename result::type = std::true_type;
32 /// \endcode
33 /// otherwise
34 /// \code
35 /// typename result::type = std::false_type;
36 /// \endcode
37 ///
38 /// \example
39 /// \snippet Test_HasInequivalence.cpp has_inequivalence_example
40 /// \see has_equivalence
41 /// \tparam T the type we want to know if it has operator!=
42 template <typename T, typename U = void>
44 
45 /// \cond HIDDEN_SYMBOLS
46 template <typename T>
47 struct has_inequivalence<
48  T, cpp17::void_t<decltype(std::declval<T>() != std::declval<T>())>>
49  : std::true_type {};
50 /// \endcond
51 
52 /// \see has_inequivalence
53 template <typename T>
55 
56 /// \see has_inequivalence
57 template <typename T>
59 // @}
60 } // namespace tt
void void_t
Given a set of types, returns void
Definition: TypeTraits.hpp:187
typename has_inequivalence< T >::type has_inequivalence_t
Definition: HasInequivalence.hpp:58
A collection of useful type traits.
Definition: TensorExpression.hpp:113
constexpr bool has_inequivalence_v
Definition: HasInequivalence.hpp:54
Check if type T has operator!= defined.
Definition: HasInequivalence.hpp:43