小编sca*_*arf的帖子

错误:使用太空船运算符 (<=>) 比较模板类时,零作为空指针常量

类似的问题:warning: Zero as nullpointerconstant while Comparison iterators - 这是关于比较迭代器的,这个问题是关于comoparing模板类的。

我正在将 c++14 代码库迁移到 c++20。但是使用 spaceship Operator 会发出警告zero as null pointer constant,我无法弄清楚为什么会发生这种情况以及错误意味着什么。

clang++14与 一起使用-std=c++20 -Werror -Wzero-as-null-pointer-constant

下面是最小的可重现示例,也可以在 godbolt 上运行

#include <compare>

template<typename V, typename U>
class quantity
{
    public:
        using value_type = V;
        using unit_type = U;
        using this_type = quantity<value_type, unit_type>;

        constexpr quantity() : value_() {}
        constexpr quantity( const value_type &v, unit_type ) : value_( v ) {}

        constexpr auto operator<=>( const this_type …
Run Code Online (Sandbox Code Playgroud)

c++ c++20

11
推荐指数
1
解决办法
714
查看次数

git status 行数已更改

我希望 git status 也列出更改的行数,\n就像那些+和:-git pull

\n

例子)

\n
\xe2\x9d\xaf LANG=c git status\nOn branch develop\nYour branch is up to date with \'upstream/develop\'.\n\nChanges not staged for commit:\n  (use "git add <file>..." to update what will be committed)\n  (use "git restore <file>..." to discard changes in working directory)\n        modified:   package-lock.json | 1093 ++++++++---\n        modified:   package.json      | 26   +++---\n
Run Code Online (Sandbox Code Playgroud)\n

因为我在文档中找不到这样的选项,所以我尝试使用diffstat,因为它用于git pull

\n
\xe2\x9d\xaf git diff | diffstat -C\n package-lock.json | 1093 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------\n package.json      | …
Run Code Online (Sandbox Code Playgroud)

git git-diff diffstat

5
推荐指数
0
解决办法
1036
查看次数

标签 统计

c++ ×1

c++20 ×1

diffstat ×1

git ×1

git-diff ×1