add include guard for all headers

This commit is contained in:
Johannes Kapfhammer 2022-03-31 21:41:11 +02:00
parent b8e3f1058c
commit 33bcd2f073
Signed by: johannesk
GPG Key ID: 565B82ED229ACA80
6 changed files with 24 additions and 11 deletions

View File

@ -7,8 +7,8 @@
// //
// The global operator<< overload hs been removed // The global operator<< overload hs been removed
#ifndef SOI_PRETTY_PRINT #ifndef SOI_HEADER_PRETTY_PRINT
#define SOI_PRETTY_PRINT #define SOI_HEADER_PRETTY_PRINT
#include <cstddef> #include <cstddef>
#include <iterator> #include <iterator>
@ -493,4 +493,4 @@ pretty_print(std::basic_ostream<TChar, TCharTraits> &stream,
} // namespace soi } // namespace soi
#endif // SOI_PRETTY_PRETTY_PRINT #endif // SOI_HEADER_PRETTY_PRETTY_PRINT

View File

@ -7,8 +7,8 @@
// initialize with dbg_init() to enable colorized output // initialize with dbg_init() to enable colorized output
// //
#ifndef SOI_DBG #ifndef SOI_HEADER_DBG
#define SOI_DBG #define SOI_HEADER_DBG
#include <cstddef> #include <cstddef>
#include <cstring> #include <cstring>
@ -239,4 +239,4 @@ template <typename T> T &&identity(T &&t) { return std::forward<T>(t); }
#define dbg(...) SOI_DBG_IMPL(SOI_IS_NONEMPTY(__VA_ARGS__), __VA_ARGS__) #define dbg(...) SOI_DBG_IMPL(SOI_IS_NONEMPTY(__VA_ARGS__), __VA_ARGS__)
#endif #endif
#endif // SOI_DBG #endif // SOI_HEADER_DBG

View File

@ -2,6 +2,9 @@
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#ifndef SOI_HEADER_DEPRECATE
#define SOI_HEADER_DEPRECATE
#pragma GCC diagnostic error "-Wdeprecated-declarations" #pragma GCC diagnostic error "-Wdeprecated-declarations"
struct endl_is_evil_t { struct endl_is_evil_t {
@ -86,3 +89,5 @@ free(void *ptr, std::size_t new_size);
//operator new(std::size_t sz); //operator new(std::size_t sz);
//[[deprecated("delete is evil. Use a vector.")]] void //[[deprecated("delete is evil. Use a vector.")]] void
//operator delete(void *ptr) noexcept; //operator delete(void *ptr) noexcept;
#endif // SOI_HEADER_DEPRECATE

View File

@ -2,6 +2,9 @@
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#ifndef SOI_HEADER_IO
#define SOI_HEADER_IO
#include <iostream> #include <iostream>
#include <cassert> #include <cassert>
#include <vector> #include <vector>
@ -93,3 +96,5 @@ void print(Arg&& arg, Args&&... args) {
void print() { void print() {
std::cout << '\n'; std::cout << '\n';
} }
#endif // SOI_HEADER_IO

View File

@ -2,6 +2,9 @@
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#ifndef SOI_HEADER_REDIRECT
#define SOI_HEADER_REDIRECT
#include <ostream> #include <ostream>
#include <streambuf> #include <streambuf>
@ -95,3 +98,4 @@ void redirect_input(const char *filename) {
void redirect_input(std::string const &filename) { void redirect_input(std::string const &filename) {
redirect_input(filename.c_str()); redirect_input(filename.c_str());
} }
#endif // SOI_HEADER_REDIRECT

View File

@ -1,14 +1,11 @@
// -*- c++ -*- // -*- c++ -*-
/*
Students: please don't try to understand the details of headers just
yet. All will be explained. This header is primarily used so that you don't
have to understand every concept all at once.
*/
// Copyright Johannes Kapfhammer 2019-2022. // Copyright Johannes Kapfhammer 2019-2022.
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#ifndef SOI_HEADER_INCLUDED
#define SOI_HEADER_INCLUDED
#include "bits/include-all.hpp" #include "bits/include-all.hpp"
@ -93,3 +90,5 @@ using soi::interactive_task;
#define int int64_t #define int int64_t
using namespace std; using namespace std;
#endif // SOI_HEADER_INCLUDED