Inconsistent stream operators

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

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Active
Tech stack
cpp

Research direction

Review the generator and distribution stream-operator implementations, the BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR and BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR macros, and PR #156. First resolve whether the macros should be removed, applied consistently, or combined with BOOST_RANDOM_NO_STREAM_OPERATORS. Done means the chosen policy is applied consistently across the affected operators.

Written by the indexing model from the issue text.

Description

Found this while working on the fix in https://github.com/boostorg/random/pull/156

There are 2 levels of preprocessor macros used for the stream operators of generators and distributions:

  1. BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR / BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR
    Replacement using static print/read functions for BOOST_MSVC, <= 1310 and SUNPRO_CC
  2. BOOST_RANDOM_NO_STREAM_OPERATORS: Disable stream operators when BOOST_NO_OPERATORS_IN_NAMESPACE || BOOST_NO_MEMBER_TEMPLATE_FRIENDS

However they are used very inconsistently.

I can offer to fix this but would need a decision first:

  1. Get rid of all those macros replacing them by standard operator<< where used
  2. Use them where not used yet
    2b. Then use BOOST_RANDOM_NO_STREAM_OPERATORS to turn those macros into static print & read functions, as current just without the operators instead of having to check for this macro in each case.
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.