Defining a Discrete Probability Distribution in C++

戏子无情 提交于 2019-12-12 00:24:14

问题


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());

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

The 2 errors are as follows:

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) 

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


回答1:


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



来源:https://stackoverflow.com/questions/31175655/defining-a-discrete-probability-distribution-in-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!