Skip to content

Commit 48ad09d

Browse files
authored
Modernize id_t.hpp (#563)
1 parent dda62b1 commit 48ad09d

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

include/CXXGraph/Utility/id_t.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
#pragma once
22

3+
#ifdef CXXGRAPH_ID_TYPE
34
#include <type_traits>
4-
5-
#define IS_UNSIGNED(T) !(((T) - 1) < 0)
5+
#else
6+
#include <cstddef>
7+
#endif
68

79
namespace CXXGraph {
810
#ifdef CXXGRAPH_ID_TYPE
911
// Throw compiler error if the type is signed
10-
static_assert(IS_UNSIGNED(CXXGRAPH_ID_TYPE),
12+
static_assert(std::is_unsigned_v<CXXGRAPH_ID_TYPE>,
1113
"CXXGRAPH_ID_TYPE must be unsigned");
1214

13-
typedef CXXGRAPH_ID_TYPE id_t;
15+
using id_t = CXXGRAPH_ID_TYPE;
1416
#else
15-
typedef std::size_t id_t;
17+
using id_t = std::size_t;
1618
#endif
1719
} // namespace CXXGraph

0 commit comments

Comments
 (0)