boostorg / boostorg/logic

Usability issue: boost::tribool::value_t is public

Open
#16 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
12
Forks
41
PR merge metrics
No merged PRs in 30d

Description

The tribool interface is not very user-friendly, I saw more than once following error:

assignment:
````
boost::tribool v1 = boost::tribool::false_value;
boost::tribool v2 = boost::tribool::true_value;
boost::tribool v3 = boost::tribool::indeterminate_value;
````

comparison:

````
v1 == boost::tribool::false_value;
v2 == boost::tribool::true_value;
v3 == boost::tribool::indeterminate_value;
````

The issue is frequent because of auto completion.
Since `operator==`, `operator safe_bool` and the function `indeterminate` it is possible to query the status of `boost::tribool`, I do not think there are good reasons for the `value_t` to be public.

If `boost::tribool::value_t` is changed to private, some function like `indeterminate` and `operator!` needs to be made friends, but otherwise there should be no other issues.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.