https://github.com/kei-g/truth
No conditional branch
https://github.com/kei-g/truth
cpp
Last synced: 11 months ago
JSON representation
No conditional branch
- Host: GitHub
- URL: https://github.com/kei-g/truth
- Owner: kei-g
- License: bsd-3-clause
- Created: 2018-10-27T03:42:26.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2021-07-07T15:11:52.000Z (about 5 years ago)
- Last Synced: 2025-03-30T10:12:07.310Z (over 1 year ago)
- Topics: cpp
- Language: C++
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `truth` - No conditional branch
To decrease cyclomatic complexity
## Positive Case, Before
```cpp
if (expression) {
/* Something you want to do */
}
```
## Positive Case, After
```cpp
#include "truth.hpp"
algorithm::when(expression, []() { /* Something you want to do */ });
```
or
## Negative Case, Before
```cpp
if (!expression) {
/* Something you want to do */
}
```
## Negative Case, After
```cpp
#include "truth.hpp"
algorithm::unless(expession, []() { /* Something you want to do */ });
```
[](https://opensource.org/licenses/BSD-3-Clause)