Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.49 KB | None | 0 0
  1. std::pair<std::weak_ptr<Node>, size_t> NodeSelector::rouletteWheel() const {
  2. const std::uniform_real_distribution<long double> urd;
  3. size_t i = 0;
  4. for(auto rnd = urd(shared_random_engine); rnd >= 0; ++i) {
  5. rnd -= getNormValue(i);
  6. }
  7. return std::make_pair(entries_[i - 1], i - 1);
  8. }
  9.  
  10. std::minstd_rand shared_random_engine(static_cast<unsigned int>(42));
  11.  
  12. montecarlo.cpp: In member function ‘std::pair<std::weak_ptr<MonteCarloNode>, long unsigned int> NodeSelector::rouletteWheel() const’:
  13. montecarlo.cpp:728:41: error: no match for call to ‘(const std::uniform_real_distribution<long double>) (std::minstd_rand&)’
  14. for(auto rnd = urd(shared_random_engine); rnd >= 0; ++i) {
  15. ^
  16. In file included from /usr/include/c++/7/random:49:0,
  17. from selector.h:15,
  18. from montecarlo.h:13,
  19. from montecarlo.cpp:7:
  20. /usr/include/c++/7/bits/random.h:1813:2: note: candidate: std::uniform_real_distribution<_RealType>::result_type std::uniform_real_distribution<_RealType>::operator()(_UniformRandomNumberGenerator&) [with _UniformRandomNumberGenerator = std::linear_congruential_engine<long unsigned int, 48271, 0, 2147483647>; _RealType = long double; std::uniform_real_distribution<_RealType>::result_type = long double] <near match>
  21. operator()(_UniformRandomNumberGenerator& __urng)
  22. ^~~~~~~~
  23. /usr/include/c++/7/bits/random.h:1813:2: note: passing ‘const std::uniform_real_distribution<long double>*’ as ‘this’ argument discards qualifiers
  24. /usr/include/c++/7/bits/random.h:1818:2: note: candidate: template<class _UniformRandomNumberGenerator> std::uniform_real_distribution<_RealType>::result_type std::uniform_real_distribution<_RealType>::operator()(_UniformRandomNumberGenerator&, const std::uniform_real_distribution<_RealType>::param_type&) [with _UniformRandomNumberGenerator = _UniformRandomNumberGenerator; _RealType = long double]
  25. operator()(_UniformRandomNumberGenerator& __urng,
  26. ^~~~~~~~
  27. /usr/include/c++/7/bits/random.h:1818:2: note: template argument deduction/substitution failed:
  28. montecarlo.cpp:728:41: note: candidate expects 2 arguments, 1 provided
  29. for(auto rnd = urd(shared_random_engine); rnd >= 0; ++i) {
  30. ^
  31.  
  32. for(auto rnd = urd(shared_random_engine, urd.param())
  33.  
  34. montecarlo.cpp: In member function ‘std::pair<std::weak_ptr<MonteCarloNode>, long unsigned int> NodeSelector::rouletteWheel() const’:
  35. montecarlo.cpp:728:54: error: no match for call to ‘(const std::uniform_real_distribution<long double>) (std::minstd_rand&, std::uniform_real_distribution<long double>::param_type)’
  36. for(auto rnd = urd(shared_random_engine, urd.param()); rnd >= 0; ++i) {
  37. ^
  38. In file included from /usr/include/c++/7/random:49:0,
  39. from selector.h:15,
  40. from montecarlo.h:13,
  41. from montecarlo.cpp:7:
  42. /usr/include/c++/7/bits/random.h:1813:2: note: candidate: template<class _UniformRandomNumberGenerator> std::uniform_real_distribution<_RealType>::result_type std::uniform_real_distribution<_RealType>::operator()(_UniformRandomNumberGenerator&) [with _UniformRandomNumberGenerator = _UniformRandomNumberGenerator; _RealType = long double]
  43. operator()(_UniformRandomNumberGenerator& __urng)
  44. ^~~~~~~~
  45. /usr/include/c++/7/bits/random.h:1813:2: note: template argument deduction/substitution failed:
  46. montecarlo.cpp:728:54: note: candidate expects 1 argument, 2 provided
  47. for(auto rnd = urd(shared_random_engine, urd.param()); rnd >= 0; ++i) {
  48. ^
  49. In file included from /usr/include/c++/7/random:49:0,
  50. from selector.h:15,
  51. from montecarlo.h:13,
  52. from montecarlo.cpp:7:
  53. /usr/include/c++/7/bits/random.h:1818:2: note: candidate: std::uniform_real_distribution<_RealType>::result_type std::uniform_real_distribution<_RealType>::operator()(_UniformRandomNumberGenerator&, const std::uniform_real_distribution<_RealType>::param_type&) [with _UniformRandomNumberGenerator = std::linear_congruential_engine<long unsigned int, 48271, 0, 2147483647>; _RealType = long double; std::uniform_real_distribution<_RealType>::result_type = long double] <near match>
  54. operator()(_UniformRandomNumberGenerator& __urng,
  55. ^~~~~~~~
  56. /usr/include/c++/7/bits/random.h:1818:2: note: passing ‘const std::uniform_real_distribution<long double>*’ as ‘this’ argument discards qualifiers
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement