Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
326 views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...