boostorg / boostorg/random

Inconsistent stream operators

Open
#165 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
42
Forks
76
Avg merge
4d 8h
Merged PRs (30d)
5

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.

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.