2018-06-16 00:19:29 +02:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
|
|
|
|
2019-02-05 13:58:38 +01:00
|
|
|
#define HAVE_IRCD_STDINC_H
|
|
|
|
|
2018-06-16 00:19:29 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Standard includes
|
|
|
|
//
|
|
|
|
// This header includes almost everything we use out of the standard library.
|
|
|
|
// This is a pre-compiled header. Project build time is significantly reduced
|
|
|
|
// by doing things this way and C++ std headers have very little namespace
|
|
|
|
// pollution and risk of conflicts.
|
|
|
|
//
|
|
|
|
|
2020-06-26 19:33:01 +02:00
|
|
|
// This pragma overrides any -fvisibility option on any unit to maintain
|
|
|
|
// consistent default visibility of these items.
|
2019-05-02 23:13:27 +02:00
|
|
|
#pragma GCC visibility push(default)
|
|
|
|
|
2020-06-26 19:33:01 +02:00
|
|
|
// Windows Specific
|
|
|
|
#ifdef _WIN32
|
|
|
|
#define WIN32_LEAN_AND_MEAN 1
|
|
|
|
#include <RB_INC_WINDOWS_H
|
|
|
|
#include <RB_INC_WINSOCK2_H
|
|
|
|
#include <RB_INC_WS2TCPIP_H
|
|
|
|
#include <RB_INC_IPHLPAPI_H
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// System/platform preambles
|
2018-06-16 00:19:29 +02:00
|
|
|
extern "C"
|
|
|
|
{
|
2020-06-26 19:33:01 +02:00
|
|
|
// We have our own assert if possible; some system headers forefully
|
|
|
|
// redefine it so we can't include this if so.
|
2020-06-05 08:14:13 +02:00
|
|
|
#ifndef assert
|
|
|
|
#include <RB_INC_ASSERT_H
|
|
|
|
#endif
|
|
|
|
|
2018-09-15 09:14:22 +02:00
|
|
|
#include <RB_INC_UNISTD_H
|
2019-06-04 22:49:33 +02:00
|
|
|
#include <RB_INC_SYS_TYPES_H
|
2018-06-16 00:19:29 +02:00
|
|
|
#include <RB_INC_SYS_UTSNAME_H
|
|
|
|
}
|
|
|
|
|
2020-06-26 19:33:01 +02:00
|
|
|
// Typography
|
|
|
|
#include <RB_INC_CSTDARG
|
2018-06-16 00:19:29 +02:00
|
|
|
#include <RB_INC_CSTDDEF
|
|
|
|
#include <RB_INC_CSTDINT
|
2019-03-15 21:01:26 +01:00
|
|
|
#include <RB_INC_CSTDLIB
|
2018-06-16 00:19:29 +02:00
|
|
|
#include <RB_INC_LIMITS
|
|
|
|
#include <RB_INC_TYPEINDEX
|
2020-06-26 19:33:01 +02:00
|
|
|
#include <RB_INC_TYPE_TRAITS
|
|
|
|
|
|
|
|
// Errors
|
2018-06-16 00:19:29 +02:00
|
|
|
#include <RB_INC_CERRNO
|
|
|
|
#include <RB_INC_EXCEPTION
|
|
|
|
#include <RB_INC_SYSTEM_ERROR
|
2020-06-26 19:33:01 +02:00
|
|
|
|
|
|
|
// Dynamic memory
|
|
|
|
#include <RB_INC_NEW
|
|
|
|
#include <RB_INC_MEMORY
|
|
|
|
|
|
|
|
// Containers
|
|
|
|
#include <RB_INC_VARIANT
|
|
|
|
#include <RB_INC_OPTIONAL
|
2018-06-16 00:19:29 +02:00
|
|
|
#include <RB_INC_ARRAY
|
2020-06-26 19:33:01 +02:00
|
|
|
#include <RB_INC_BITSET
|
2018-06-16 00:19:29 +02:00
|
|
|
#include <RB_INC_VECTOR
|
|
|
|
#include <RB_INC_STACK
|
|
|
|
#include <RB_INC_FORWARD_LIST
|
2020-06-26 19:33:01 +02:00
|
|
|
#include <RB_INC_LIST
|
2018-06-16 00:19:29 +02:00
|
|
|
#include <RB_INC_DEQUE
|
|
|
|
#include <RB_INC_QUEUE
|
2020-06-26 19:33:01 +02:00
|
|
|
#include <RB_INC_SET
|
|
|
|
#include <RB_INC_MAP
|
|
|
|
#include <RB_INC_UNORDERED_MAP
|
|
|
|
|
|
|
|
// Strings
|
|
|
|
#include <RB_INC_CUCHAR
|
|
|
|
#include <RB_INC_CSTRING
|
|
|
|
#include <RB_INC_LOCALE
|
|
|
|
#include <RB_INC_CODECVT
|
|
|
|
#include <RB_INC_STRING
|
|
|
|
#include <RB_INC_STRING_VIEW
|
|
|
|
|
|
|
|
// Numerics
|
|
|
|
#include <RB_INC_CFENV
|
|
|
|
#include <RB_INC_CMATH
|
|
|
|
#include <RB_INC_NUMERIC
|
|
|
|
#include <RB_INC_RANDOM
|
|
|
|
|
|
|
|
// Chronography
|
2018-06-16 00:19:29 +02:00
|
|
|
#include <RB_INC_CTIME
|
2020-06-26 19:33:01 +02:00
|
|
|
#include <RB_INC_CHRONO
|
|
|
|
|
|
|
|
// Concurrency
|
2018-06-16 00:19:29 +02:00
|
|
|
#include <RB_INC_ATOMIC
|
|
|
|
#include <RB_INC_THREAD
|
|
|
|
#include <RB_INC_MUTEX
|
|
|
|
#include <RB_INC_SHARED_MUTEX
|
|
|
|
#include <RB_INC_CONDITION_VARIABLE
|
|
|
|
|
2020-06-26 19:33:01 +02:00
|
|
|
// Input/Output
|
|
|
|
#include <RB_INC_CSTDIO
|
|
|
|
#include <RB_INC_IOSFWD
|
|
|
|
#include <RB_INC_SSTREAM
|
|
|
|
#include <RB_INC_FSTREAM
|
|
|
|
#include <RB_INC_IOMANIP
|
|
|
|
|
|
|
|
// Other standard suites
|
|
|
|
#include <RB_INC_UTILITY
|
2020-08-01 07:12:14 +02:00
|
|
|
#include <RB_INC_EXECUTION
|
2020-06-26 19:33:01 +02:00
|
|
|
#include <RB_INC_FUNCTIONAL
|
|
|
|
#include <RB_INC_ALGORITHM
|
|
|
|
#include <RB_INC_FILESYSTEM
|
2018-06-16 00:19:29 +02:00
|
|
|
|
2020-06-27 23:25:56 +02:00
|
|
|
// Other
|
|
|
|
#include <RB_INC_X86INTRIN_H
|
|
|
|
|
2019-06-04 22:49:33 +02:00
|
|
|
// These are #defined in stdio.h. If the system includes it indirectly we have
|
|
|
|
// to undef those here or there will be trouble.
|
|
|
|
#undef stdin
|
|
|
|
#undef stdout
|
|
|
|
#undef stderr
|
|
|
|
|
2019-12-31 22:41:45 +01:00
|
|
|
// Historical macros from types.h
|
|
|
|
#undef major
|
|
|
|
#undef minor
|
|
|
|
|
2018-06-16 00:19:29 +02:00
|
|
|
//////////////////////////////////////////////////////////////////////////////>
|
|
|
|
//
|
|
|
|
// Pollution
|
|
|
|
//
|
|
|
|
// This section lists all of the items introduced outside of our namespace
|
|
|
|
// which may conflict with your project.
|
|
|
|
//
|
|
|
|
|
|
|
|
// Experimental std::string_view
|
|
|
|
#if !defined(__cpp_lib_string_view) && defined(__cpp_lib_experimental_string_view)
|
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
using experimental::string_view;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Experimental std::optional
|
|
|
|
#if !defined(__cpp_lib_optional) && defined(__cpp_lib_experimental_optional)
|
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
using experimental::optional;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-07-01 23:10:20 +02:00
|
|
|
// Forward declare the existence of these in std:: to allow their immediate
|
|
|
|
// use throughout the project as a developer convenience. <iostream> is not
|
|
|
|
// included here because it generates naive initialization code in every unit,
|
|
|
|
// whereas we conduct it once for libircd in the right place.
|
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
extern istream cin;
|
|
|
|
extern ostream cout;
|
|
|
|
extern ostream cerr;
|
|
|
|
}
|
|
|
|
|
2018-06-16 00:19:29 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// libircd API
|
|
|
|
//
|
|
|
|
// Some items imported into our namespace.
|
2019-03-22 00:23:40 +01:00
|
|
|
//
|
|
|
|
|
|
|
|
namespace ircd
|
|
|
|
{
|
2020-04-27 22:58:39 +02:00
|
|
|
using longlong = long long;
|
|
|
|
using ulonglong = unsigned long long;
|
|
|
|
|
2018-06-16 00:19:29 +02:00
|
|
|
using std::get;
|
|
|
|
using std::end;
|
|
|
|
using std::begin;
|
|
|
|
|
|
|
|
using std::nullptr_t;
|
|
|
|
using std::nothrow_t;
|
|
|
|
|
|
|
|
using std::const_pointer_cast;
|
|
|
|
using std::static_pointer_cast;
|
|
|
|
using std::dynamic_pointer_cast;
|
|
|
|
|
|
|
|
using std::chrono::hours;
|
2018-09-17 03:19:23 +02:00
|
|
|
using std::chrono::minutes;
|
2018-06-16 00:19:29 +02:00
|
|
|
using std::chrono::seconds;
|
|
|
|
using std::chrono::milliseconds;
|
|
|
|
using std::chrono::microseconds;
|
|
|
|
using std::chrono::nanoseconds;
|
2018-10-21 09:54:06 +02:00
|
|
|
using std::chrono::duration;
|
2018-06-16 00:19:29 +02:00
|
|
|
using std::chrono::duration_cast;
|
|
|
|
using std::chrono::system_clock;
|
|
|
|
using std::chrono::steady_clock;
|
|
|
|
using std::chrono::high_resolution_clock;
|
|
|
|
using std::chrono::time_point;
|
|
|
|
|
|
|
|
using namespace std::string_literals;
|
2019-06-23 08:28:48 +02:00
|
|
|
using namespace std::chrono_literals;
|
|
|
|
using namespace std::literals::chrono_literals;
|
|
|
|
using std::string_literals::operator""s;
|
|
|
|
using std::chrono_literals::operator""s;
|
2018-06-16 00:19:29 +02:00
|
|
|
|
|
|
|
namespace ph = std::placeholders;
|
|
|
|
|
|
|
|
template<class... T> using ilist = std::initializer_list<T...>;
|
2018-11-09 06:18:39 +01:00
|
|
|
|
|
|
|
using std::error_code;
|
2020-10-10 10:15:48 +02:00
|
|
|
|
|
|
|
/// Simple gimmick to allow shorter declarations when both elements
|
|
|
|
/// of a pair are the same.
|
|
|
|
template<class A,
|
|
|
|
class B = A>
|
|
|
|
using pair = std::pair<A, B>;
|
2018-06-16 00:19:29 +02:00
|
|
|
}
|
2019-05-02 23:13:27 +02:00
|
|
|
|
|
|
|
#pragma GCC visibility pop // default
|