soi-header/README.md

60 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

2019-10-06 16:45:29 +02:00
# `#include <soi>`
Include soi and you're ready to go!
2019-10-06 17:40:46 +02:00
## Features
2019-10-06 16:45:29 +02:00
2019-10-06 17:40:46 +02:00
- includes all headers (a `bits/stdc++.h` that works on all platforms)
- has a powerful `dbg()` macro
- disables output buffering
- checks whether all input has been read
- removes evil functions from the standard library such as new and printf.
- defines int to 64 bit
The header requires at least C++11.
2019-10-06 16:45:29 +02:00
## Configuration
You can set the following environment variables to customize the behaviour.
`SOI_COLOR`: By default, colored output is shown in case a terminal is connected.
You can force colors with `SOI_COLOR=1` and shut them off with `SOI_COLOR=0`.
2019-10-06 16:45:29 +02:00
`SOI_EOFCHECK`: By default, it is *not* checked, whether you have read all the
2019-10-06 16:45:29 +02:00
input. In case you pipe the input from a file or want to issue a proper EOF
character (Control D under linux or Control Z under Windows), you can enable
this check using `SOI_EOFCHECK=1`.
2019-10-06 16:45:29 +02:00
## Template
Using this header is as simple as:
2019-10-06 17:40:46 +02:00
```c++
2019-10-06 16:45:29 +02:00
#include <soi>
signed main() {
// your code goes here
}
```
2019-10-06 17:40:46 +02:00
## Example
See example.cpp for a larger example.
```c++
#include <soi>
signed main() {
dbg("hi");
vector<int> pi{3,1,4,1,5,9,2,6};
dbg(pi);
int x=4;
dbg(x+3);
}
```
prints:
```
[test.cpp:3 (main)] hi
[test.cpp:5 (main)] pi = [3, 1, 4, 1, 5, 9, 2, 6] (vector<long int>)
[test.cpp:7 (main)] x+3 = 7 (long int)
```