https://github.com/kei-g/truth
No conditional branch
https://github.com/kei-g/truth
cpp
Last synced: 3 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 6 years ago)
- Default Branch: main
- Last Pushed: 2021-07-07T15:11:52.000Z (almost 4 years ago)
- Last Synced: 2025-02-05T11:52:19.091Z (4 months 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)