本文介绍了在C ++中定义离散概率分布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图在Visual Studio(C ++)中创建自己的离散发行版。我一直收到同样的错误。然后,我尝试了以下示例代码:。

I have been trying to create my own discrete distribution in Visual Studio (C++). I kept getting the same error. I then tried the example code from: http://www.cplusplus.com/reference/random/discrete_distribution/discrete_distribution/.

同样,此示例代码也出现了相同的错误。

Again, the same error appeared with this example code.

(从链接中)出现错误的代码行是:

The line of code (from the link) that is giving me an error is:

std::discrete_distribution second(init.begin(), init.end());

尤其是 init.begin()是红色下划线。

Particularly, init.begin() is underlined in red.

这两个错误如下:

error C2661: 'std::discrete_distribution::discrete_distribution' : no overloaded function takes 2 arguments

IntelliSense: no instance of constructor "std::discrete_distribution<_Ty>::discrete_distribution [with _Ty=int]" matches the argument list argument types are: (std::_Array_iterator, std::_Array_iterator)

为什么我的编译器不工作?我想知道其他人是否也遇到相同的错误?我还刚刚更新了我的Visual Studio版本,以确保它不是旧错误

Why would my compiler not work? I am wondering if other people are getting the same errors? I also just updated my version of Visual Studio to make sure it wasn't an old bug

推荐答案

问题是由于VS Express 2013中的错误。通过安装VS Community 2015,错误消息消失了。

The problem was due to a bug in VS express 2013. By installing VS Community 2015, the error message vanished.

这篇关于在C ++中定义离散概率分布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 04:27
查看更多