type/value mismatch in discrete_distribution.hpp

Open
#72 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp
Domain
backend

Research direction

Inspect include/boost/random/discrete_distribution.hpp around line 603 and reproduce the reported compiler diagnostic with a minimal build or the project’s existing checks. Compare the condition with the suggested substitution, then verify that the header compiles without the type/value mismatch and that relevant random-module tests still pass.

Written by the indexing model from the issue text.

Description

This condition leads to

/usr/include/boost/random/discrete_distribution.hpp:603:32: error: type/value mismatch at argument 1 in template parameter list for ‘template<class First, class ... Others> using first = First’
  603 |             if(a_iter->first < normalized_average) {
      |                                ^~~~~~~~~~~~~~~~~~
/usr/include/boost/random/discrete_distribution.hpp:603:32: note:   expected a type, got ‘normalized_average’

Substituting with std::less(a_iter->first, normalized_average) fixes this issue.

Dominant language
C++
Stars
42
Forks
76
Avg merge
3d 22h
Merged PRs (30d)
6

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/random

All issues in boostorg/random

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.