зеркало из https://github.com/microsoft/snmalloc.git
Add some more checkers.
Change the result of `operator=` on `Mod` to return `Mod&`. In this example: ```c++ Mod<4, int> a; int b = (a = 8); ``` The value of `b` will now be 0, not 8, and will equal the value of `a`. Hopefully this is less confusing to users of this class.
This commit is contained in:
Родитель
22d33ebf99
Коммит
b5bc09ced3
|
@ -1 +1,7 @@
|
|||
Checks: '-*,clang-diagnostic-*,google-readability-casting,readability-else-after-return,performance-unnecessary-copy-initialization,bugprone-use-after-move,modernize-use-nullptr'
|
||||
Checks: '-*,clang-diagnostic-*,google-readability-casting,readability-else-after-return,performance-unnecessary-copy-initialization,bugprone-use-after-move,modernize-use-nullptr,modernize-redundant-void-arg,modernize-return-braced-init-list,modernize-use-default-member-init,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nodiscard,modernize-use-override,cppcoreguidelines-avoid-goto,misc-unconventional-assign-operator'
|
||||
# It would be nice to enable:
|
||||
# - readability-magic-numbers
|
||||
# - modernize-avoid-c-arrays
|
||||
CheckOptions:
|
||||
- key: modernize-use-default-member-init.UseAssignment
|
||||
value: '1'
|
||||
|
|
|
@ -53,10 +53,10 @@ namespace snmalloc
|
|||
return static_cast<T>(value & (length - 1));
|
||||
}
|
||||
|
||||
T& operator=(const T v)
|
||||
Mod& operator=(const T v)
|
||||
{
|
||||
value = v;
|
||||
return value;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче