Compare commits
3 Commits
b3250096e1
...
19ddcef24e
Author | SHA1 | Date |
---|---|---|
Johannes Kapfhammer | 19ddcef24e | |
Johannes Kapfhammer | 33bcd2f073 | |
Johannes Kapfhammer | b8e3f1058c |
|
@ -0,0 +1,23 @@
|
||||||
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
this license (the "Software") to use, reproduce, display, distribute,
|
||||||
|
execute, and transmit the Software, and to prepare derivative works of the
|
||||||
|
Software, and to permit third-parties to whom the Software is furnished to
|
||||||
|
do so, all subject to the following:
|
||||||
|
|
||||||
|
The copyright notices in the Software and this entire statement, including
|
||||||
|
the above license grant, this restriction and the following disclaimer,
|
||||||
|
must be included in all copies of the Software, in whole or in part, and
|
||||||
|
all derivative works of the Software, unless such copies or derivative
|
||||||
|
works are solely in the form of machine-executable object code generated by
|
||||||
|
a source language processor.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
|
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
|
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
|
@ -72,6 +72,11 @@ signed main() {
|
||||||
print(tuple{unordered_map<int, string>{{3,"three"},{1,"one"}}});
|
print(tuple{unordered_map<int, string>{{3,"three"},{1,"one"}}});
|
||||||
print(unordered_set<int>{3,1,4});
|
print(unordered_set<int>{3,1,4});
|
||||||
|
|
||||||
|
print_no_space("Case #", 0, ": ");
|
||||||
|
print_no_space(42);
|
||||||
|
print_no_space();
|
||||||
|
print();
|
||||||
|
|
||||||
redirect_input("example.in");
|
redirect_input("example.in");
|
||||||
print("reading from example.in:", read_string());
|
print("reading from example.in:", read_string());
|
||||||
redirect_input("example.in");
|
redirect_input("example.in");
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Copyright Johannes Kapfhammer 2019-2022.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright Johannes Kapfhammer 2019.
|
// 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)
|
||||||
|
@ -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
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
// Copyright Johannes Kapfhammer 2019-2022.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// 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 {
|
||||||
|
@ -82,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
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
// Copyright Johannes Kapfhammer 2019-2022.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// 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>
|
||||||
|
@ -89,3 +96,11 @@ void print(Arg&& arg, Args&&... args) {
|
||||||
void print() {
|
void print() {
|
||||||
std::cout << '\n';
|
std::cout << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
void print_no_space(Args&&... args) {
|
||||||
|
using expander = bool[];
|
||||||
|
(void)expander{0, (soi::io::print(std::cout, std::forward<Args>(args)), false)...};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // SOI_HEADER_IO
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
// Copyright Johannes Kapfhammer 2019.
|
// 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)
|
||||||
//
|
//
|
||||||
// pretty pretty_printing with c++
|
// pretty pretty_printing with c++
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef SOI_PRETTY
|
#ifndef SOI_PRETTY
|
||||||
#define SOI_PRETTY
|
#define SOI_PRETTY
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
// Copyright Johannes Kapfhammer 2019-2022.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
#ifndef SOI_HEADER_REDIRECT
|
||||||
|
#define SOI_HEADER_REDIRECT
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
|
|
||||||
|
@ -91,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
|
||||||
|
|
14
include/soi
14
include/soi
|
@ -1,9 +1,11 @@
|
||||||
// -*- c++ -*-
|
// -*- c++ -*-
|
||||||
/*
|
// Copyright Johannes Kapfhammer 2019-2022.
|
||||||
Students: please don't try to understand the details of headers just
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
yet. All will be explained. This header is primarily used so that you don't
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
have to understand every concept all at once.
|
// 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"
|
||||||
|
|
||||||
|
@ -88,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
|
||||||
|
|
Loading…
Reference in New Issue