Skip to content

Commit

Permalink
clang-tidy: Suppres modernize-type-traits
Browse files Browse the repository at this point in the history
  • Loading branch information
krivenko committed May 13, 2024
1 parent 1e305dd commit 1786894
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/libcommute/expression/expression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ template <typename ScalarType, typename... IndexTypes> class expression {
// Disable overload for expressions
template <typename T>
using disable_for_expression =
// NOLINTNEXTLINE(modernize-type-traits)
typename std::enable_if<!is_expression<T>::value>::type;

public:
Expand Down
3 changes: 2 additions & 1 deletion include/libcommute/expression/monomial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ template <typename... IndexTypes> class monomial {
// Helper method for one of constructors
template <typename GenType1, typename... GenTypesTail>
void constructor_impl(GenType1&& generator, GenTypesTail&&... more_gens) {
// NOLINTNEXTLINE(modernize-type-traits)
using gen1_t = typename std::remove_reference<GenType1>::type;
generators_.emplace_back(
make_unique<gen1_t>(std::forward<GenType1>(generator)));
Expand All @@ -62,7 +63,7 @@ template <typename... IndexTypes> class monomial {

// Construct from a list of >=1 generators
template <typename... GenTypes,
typename = typename std::enable_if<
typename = typename std::enable_if< // NOLINT(modernize-type-traits)
all_are_generators<GenTypes...>::value>::type>
explicit monomial(GenTypes&&... generators) {
constructor_impl(std::forward<GenTypes>(generators)...);
Expand Down
1 change: 1 addition & 0 deletions include/libcommute/metafunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ using std::make_unique;

template <typename T> struct remove_cvref {
using type =
// NOLINTNEXTLINE(modernize-type-traits)
typename std::remove_cv<typename std::remove_reference<T>::type>::type;
};
template <typename T> using remove_cvref_t = typename remove_cvref<T>::type;
Expand Down
1 change: 1 addition & 0 deletions include/libcommute/scalar_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ template <typename T> struct is_complex<std::complex<T>> : std::true_type {};

// Enable template instantiation if Trait<T>::value is true
template <template <typename> class Trait, typename T>
// NOLINTNEXTLINE(modernize-type-traits)
using with_trait = typename std::enable_if<Trait<T>::value>::type;

// Traits of types that can be used as the ScalarType parameter of `expression`.
Expand Down
7 changes: 7 additions & 0 deletions include/libcommute/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,16 @@ namespace detail {

template <typename Base, typename T, typename... Tail>
struct all_derived_from_impl {
// NOLINTNEXTLINE(modernize-type-traits)
using T_ = typename std::remove_reference<T>::type;
// NOLINTNEXTLINE(modernize-type-traits)
static constexpr bool value = std::is_base_of<Base, T_>::value &&
all_derived_from_impl<Base, Tail...>::value;
};
template <typename Base, typename T> struct all_derived_from_impl<Base, T> {
// NOLINTNEXTLINE(modernize-type-traits)
using T_ = typename std::remove_reference<T>::type;
// NOLINTNEXTLINE(modernize-type-traits)
static constexpr bool value = std::is_base_of<Base, T_>::value;
};

Expand All @@ -88,11 +92,13 @@ namespace detail {
template <typename T, typename TypeListHead, typename... TypeListTail>
struct not_in_type_list_impl {
static constexpr bool value =
// NOLINTNEXTLINE(modernize-type-traits)
(!std::is_same<T, TypeListHead>::value) &&
not_in_type_list_impl<T, TypeListTail...>::value;
};
template <typename T, typename TypeListHead>
struct not_in_type_list_impl<T, TypeListHead> {
// NOLINTNEXTLINE(modernize-type-traits)
static constexpr bool value = !std::is_same<T, TypeListHead>::value;
};

Expand Down Expand Up @@ -149,6 +155,7 @@ struct noncopyable {
//

template <typename T>
// NOLINTNEXTLINE(modernize-type-traits)
struct linear_function : std::conditional<std::is_copy_constructible<T>::value,
copyable,
noncopyable>::type {
Expand Down
2 changes: 2 additions & 0 deletions test/check_ordering.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ void check_equality_impl(std::vector<T> const& v, std::false_type) {
template <typename T> void check_equality(std::vector<T> const& v) {
check_equality_impl(
v,
// NOLINTNEXTLINE(modernize-type-traits)
std::integral_constant<bool, std::is_pointer<T>::value>());
}

Expand Down Expand Up @@ -77,6 +78,7 @@ void check_less_greater_impl(std::vector<T> const& v, std::false_type) {
template <typename T> void check_less_greater(std::vector<T> const& v) {
check_less_greater_impl(
v,
// NOLINTNEXTLINE(modernize-type-traits)
std::integral_constant<bool, std::is_pointer<T>::value>());
}

Expand Down
1 change: 1 addition & 0 deletions test/factories_dyn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ TEST_CASE("Factory functions", "[factories]") {

SECTION("make_complex()") {
auto expr = make_complex(4.0 * c_dag(1, "up") * c(2, "dn") + 1.0);
// NOLINTNEXTLINE(modernize-type-traits)
CHECK(std::is_same<decltype(expr),
expression<std::complex<double>, dyn_indices>>::value);
CHECK(expr == std::complex<double>(4, 0) * c_dag(1, "up") * c(2, "dn") +
Expand Down

0 comments on commit 1786894

Please sign in to comment.