DeepSeek R1 写出了 VC++ 2022 不能编译的代码

DeepSeek R1 写出了 VC++ 2022 不能编译的代码

DeepSeek R1 写出了 VC++ 2022 不能编译的代码

让 DeepSeek R1 写了一段用 C++ 生成随机数的代码,结果给出了错误代码,如下:

#include <random>

static std::mt19937 rng{std::random_device{}()};
std::uniform_int_distribution<uint8_t> dist(1, 255);
// 以下代码𥃻略

各位看出错在哪里了吗?是 std::uniform_int_distribution 不接受 uint8_t 作为类型参数,具体的错误提示如下:

C2338 static_assert failed: 'invalid template argument for uniform_int_distribution: N4950 [rand.req.genl]/1.5 requires one of short, int, long, long long, unsigned short, unsigned int, unsigned long, or unsigned long long'
C2338 static_assert failed: 'note: char, signed char, unsigned char, char8_t, int8_t, and uint8_t are not allowed'

在错误信息里,给出了详细的支持的和不支持的类型列表。

<完>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dowhileprogramming

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值