60 lines
1.3 KiB
Markdown
60 lines
1.3 KiB
Markdown
# `#include <soi>`
|
|
|
|
Include soi and you're ready to go!
|
|
|
|
## Features
|
|
|
|
- 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.
|
|
|
|
## 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`.
|
|
|
|
`SOI_EOFCHECK`: By default, it is *not* checked, whether you have read all the
|
|
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`.
|
|
|
|
## Template
|
|
Using this header is as simple as:
|
|
|
|
```c++
|
|
#include <soi>
|
|
|
|
signed main() {
|
|
// your code goes here
|
|
}
|
|
```
|
|
|
|
## 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)
|
|
```
|