mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:27:45 +00:00
AK: Prefer using instead of typedef
Problem: - `typedef` is a keyword which comes from C and carries with it old syntax that is hard to read. - Creating type aliases with the `using` keyword allows for easier future maintenance because it supports template syntax. - There is inconsistent use of `typedef` vs `using`. Solution: - Use `clang-tidy`'s checker called `modernize-use-using` to update the syntax to use the newer syntax. - Remove unused functions to make `clang-tidy` happy. - This results in consistency within the codebase.
This commit is contained in:
parent
6b97118e89
commit
f5ced347e6
12 changed files with 83 additions and 93 deletions
|
@ -66,7 +66,7 @@ namespace AK {
|
|||
*/
|
||||
template<typename T, bool Incr, bool Cmp, bool Bool, bool Flags, bool Shift, bool Arith, typename X>
|
||||
class DistinctNumeric {
|
||||
typedef DistinctNumeric<T, Incr, Cmp, Bool, Flags, Shift, Arith, X> Self;
|
||||
using Self = DistinctNumeric<T, Incr, Cmp, Bool, Flags, Shift, Arith, X>;
|
||||
|
||||
public:
|
||||
DistinctNumeric(T value)
|
||||
|
@ -301,8 +301,8 @@ private:
|
|||
}
|
||||
|
||||
#define TYPEDEF_DISTINCT_NUMERIC_GENERAL(T, Incr, Cmp, Bool, Flags, Shift, Arith, NAME) \
|
||||
typedef DistinctNumeric<T, Incr, Cmp, Bool, Flags, Shift, Arith, struct __##NAME##_tag> NAME
|
||||
using NAME = DistinctNumeric<T, Incr, Cmp, Bool, Flags, Shift, Arith, struct __##NAME##_tag>;
|
||||
#define TYPEDEF_DISTINCT_ORDERED_ID(T, NAME) TYPEDEF_DISTINCT_NUMERIC_GENERAL(T, false, true, true, false, false, false, NAME)
|
||||
// TODO: Further typedef's?
|
||||
// TODO: Further type aliases?
|
||||
|
||||
using AK::DistinctNumeric;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue