Skip to content

Commit 457b27d

Browse files
authored
Resolve modernize-type-traits (#549)
1 parent 8841214 commit 457b27d

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

include/CXXGraph/Utility/TypeTraits.hpp

100755100644
Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ namespace CXXGraph {
3838
// is_node type trait
3939
template <typename T>
4040
struct is_node
41-
: std::integral_constant<
42-
bool, std::is_same<Node<typename T::Node_t>,
43-
typename std::remove_const<T>::type>::value> {};
41+
: std::integral_constant<bool,
42+
std::is_same_v<Node<typename T::Node_t>,
43+
typename std::remove_const_t<T>>> {
44+
};
4445

4546
template <typename T>
4647
struct is_node<T*> : std::false_type {};
@@ -56,11 +57,10 @@ template <typename T>
5657
struct is_node_ptr : std::false_type {};
5758

5859
template <typename T>
59-
struct is_node_ptr<T*> : std::integral_constant<bool, is_node<T>::value> {};
60+
struct is_node_ptr<T*> : std::integral_constant<bool, is_node_v<T>> {};
6061

6162
template <typename T>
62-
struct is_node_ptr<shared<T>>
63-
: std::integral_constant<bool, is_node<T>::value> {};
63+
struct is_node_ptr<shared<T>> : std::integral_constant<bool, is_node_v<T>> {};
6464

6565
template <typename T>
6666
inline constexpr bool is_node_ptr_v = is_node_ptr<T>::value;
@@ -75,10 +75,10 @@ inline constexpr bool all_are_node_ptrs_v = all_are_node_ptrs<T, Ts...>::value;
7575

7676
// is_edge type trait
7777
template <typename T>
78-
struct is_edge
79-
: std::integral_constant<
80-
bool, std::is_base_of<Edge<typename T::Node_t>,
81-
typename std::remove_const<T>::type>::value> {};
78+
struct is_edge : std::integral_constant<
79+
bool, std::is_base_of_v<Edge<typename T::Node_t>,
80+
typename std::remove_const_t<T>>> {
81+
};
8282

8383
template <typename T>
8484
struct is_edge<T*> : std::false_type {};
@@ -94,11 +94,10 @@ template <typename T>
9494
struct is_edge_ptr : std::false_type {};
9595

9696
template <typename T>
97-
struct is_edge_ptr<T*> : std::integral_constant<bool, is_edge<T>::value> {};
97+
struct is_edge_ptr<T*> : std::integral_constant<bool, is_edge_v<T>> {};
9898

9999
template <typename T>
100-
struct is_edge_ptr<shared<T>>
101-
: std::integral_constant<bool, is_edge<T>::value> {};
100+
struct is_edge_ptr<shared<T>> : std::integral_constant<bool, is_edge_v<T>> {};
102101

103102
template <typename T>
104103
inline constexpr bool is_edge_ptr_v = is_edge_ptr<T>::value;

0 commit comments

Comments
 (0)