run clang-format

This commit is contained in:
Johannes Kapfhammer 2019-10-06 18:38:23 +02:00
parent 4d25fc25c4
commit 492a0f3c55
5 changed files with 517 additions and 454 deletions

View file

@ -5,20 +5,20 @@
have to understand every concept all at once.
*/
#include <fstream>
#include "bits/soi-dbg.hpp"
#include <fstream>
namespace soi {
void check_for_eof() {
if (!(std::cin >> std::ws).eof())
std::cerr << "WARNING: didn't read the whole input\n";
if (!(std::cin >> std::ws).eof())
std::cerr << "WARNING: didn't read the whole input\n";
}
void noninteractive_check_eof() {
// make symbol 0x1A (Ctrl+Z) a whitespace
struct console_ctype : std::ctype<char> {
static const mask* get_table() {
static const mask *get_table() {
static const std::array<mask, table_size> table = []() {
std::array<mask, table_size> table;
std::copy(classic_table(), classic_table() + table_size, table.begin());
@ -27,14 +27,14 @@ void noninteractive_check_eof() {
}();
return table.data();
}
console_ctype(std::size_t refs = 0) : ctype(get_table(), false, refs) {}
console_ctype(std::size_t refs = 0) : ctype(get_table(), false, refs) {}
};
std::cin.imbue(std::locale(std::cin.getloc(), new console_ctype));
check_for_eof();
}
bool should_check_for_eof() {
if (const char* eofcheck_enabled = std::getenv("SOI_EOFCHECK")) {
if (const char *eofcheck_enabled = std::getenv("SOI_EOFCHECK")) {
if (!std::strcmp(eofcheck_enabled, "1"))
return true;
if (!std::strcmp(eofcheck_enabled, "0"))
@ -48,9 +48,9 @@ void initialize_debug() {
std::cin.exceptions(std::ifstream::failbit | std::ifstream::badbit);
std::ios::sync_with_stdio(false);
if (should_check_for_eof() &&
std::atexit(noninteractive_check_eof) != 0) {
std::cerr << "WARNING: soi.h -- registration of sanity check at exit failed\n";
if (should_check_for_eof() && std::atexit(noninteractive_check_eof) != 0) {
std::cerr
<< "WARNING: soi.h -- registration of sanity check at exit failed\n";
}
soi::detail::dbg_init();
}