Skip to content

Commit b9b5bf9

Browse files
committed
Extend std C++ include header list (fix hsutter#692)
1 parent d9656a0 commit b9b5bf9

File tree

1 file changed

+102
-13
lines changed

1 file changed

+102
-13
lines changed

include/cpp2util.h

Lines changed: 102 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@
8282
#include <clocale>
8383
#include <cmath>
8484
#include <codecvt>
85-
#include <condition_variable>
8685
#include <compare>
8786
#include <complex>
8887
#include <concepts>
88+
#include <condition_variable>
8989
#ifdef __cpp_lib_coroutine
9090
#include <coroutine>
9191
#endif
@@ -113,7 +113,7 @@
113113
// in our -pure-cpp2 "import std;" simulation mode... if you need this,
114114
// use mixed mode (not -pure-cpp2) and #include all the headers you need
115115
// including this one
116-
//
116+
//
117117
// #include <execution>
118118
#include <filesystem>
119119
#if defined(__cpp_lib_format) || (defined(_MSC_VER) && _MSC_VER >= 1929)
@@ -153,15 +153,15 @@
153153
#include <ranges>
154154
#include <ratio>
155155
#include <regex>
156-
#ifdef __cpp_lib_source_location
157-
#include <source_location>
158-
#endif
159156
#include <scoped_allocator>
160157
#ifdef __cpp_lib_semaphore
161158
#include <semaphore>
162159
#endif
163160
#include <set>
164161
#include <shared_mutex>
162+
#ifdef __cpp_lib_source_location
163+
#include <source_location>
164+
#endif
165165
#include <span>
166166
#ifdef __cpp_lib_spanstream
167167
#include <spanstream>
@@ -197,39 +197,128 @@
197197
// Otherwise, we're not in -pure-cpp2 and so just #include
198198
// what we need in this header to make this self-contained
199199
#else
200+
#include <version> // has the _cpp_* preprocessor defs, include first
200201
#include <algorithm>
201202
#include <any>
203+
#include <array>
204+
#include <atomic>
205+
#ifdef __cpp_lib_barrier
206+
#include <barrier>
207+
#endif
208+
#include <bit>
209+
#include <bitset>
210+
#include <cassert>
211+
#include <cctype>
212+
#include <cerrno>
213+
#include <cfenv>
214+
#include <cfloat>
215+
#include <charconv>
216+
#include <chrono>
217+
#include <cinttypes>
218+
#include <climits>
219+
#include <clocale>
220+
#include <cmath>
221+
#include <codecvt>
202222
#include <compare>
223+
#include <complex>
203224
#include <concepts>
225+
#include <condition_variable>
226+
#ifdef __cpp_lib_coroutine
227+
#include <coroutine>
228+
#endif
229+
#include <csetjmp>
230+
#include <csignal>
231+
#include <cstdarg>
204232
#include <cstddef>
205233
#include <cstdint>
206234
#include <cstdio>
235+
#include <cstdlib>
236+
#include <cstring>
237+
#include <ctime>
238+
#if __has_include(<cuchar>)
239+
#include <cuchar>
240+
#endif
241+
#include <cwchar>
242+
#include <cwctype>
243+
#include <deque>
207244
#ifndef CPP2_NO_EXCEPTIONS
208245
#include <exception>
209246
#endif
247+
#include <filesystem>
210248
#if defined(__cpp_lib_format) || (defined(_MSC_VER) && _MSC_VER >= 1929)
211249
#include <format>
212250
#endif
251+
#include <forward_list>
252+
#include <fstream>
253+
#include <functional>
254+
#include <future>
255+
#include <initializer_list>
256+
#include <iomanip>
257+
#include <ios>
258+
#include <iosfwd>
213259
#include <iostream>
260+
#include <iso646.h>
261+
#include <istream>
214262
#include <iterator>
263+
#ifdef __cpp_lib_latch
264+
#include <latch>
265+
#endif
215266
#include <limits>
267+
#include <list>
268+
#include <locale>
269+
#include <map>
216270
#include <memory>
271+
#ifdef __cpp_lib_memory_resource
272+
#include <memory_resource>
273+
#endif
274+
#include <mutex>
217275
#include <new>
218-
#include <random>
276+
#include <numbers>
277+
#include <numeric>
219278
#include <optional>
279+
#include <ostream>
280+
#include <queue>
281+
#include <random>
282+
#include <ranges>
283+
#include <ratio>
284+
#include <regex>
285+
#include <scoped_allocator>
286+
#ifdef __cpp_lib_semaphore
287+
#include <semaphore>
288+
#endif
289+
#include <set>
290+
#include <shared_mutex>
220291
#if defined(CPP2_USE_SOURCE_LOCATION)
221292
#include <source_location>
222293
#endif
223294
#include <span>
295+
#ifdef __cpp_lib_spanstream
296+
#include <spanstream>
297+
#endif
298+
#include <sstream>
299+
#include <stack>
300+
#include <stdexcept>
301+
#ifdef __cpp_lib_jthread
302+
#include <stop_token>
303+
#endif
304+
#include <streambuf>
224305
#include <string>
225306
#include <string_view>
307+
#ifdef __cpp_lib_syncstream
308+
#include <syncstream>
309+
#endif
226310
#include <system_error>
311+
#include <thread>
227312
#include <tuple>
228313
#include <type_traits>
314+
#include <typeindex>
229315
#ifndef CPP2_NO_RTTI
230316
#include <typeinfo>
231317
#endif
318+
#include <unordered_map>
319+
#include <unordered_set>
232320
#include <utility>
321+
#include <valarray>
233322
#include <variant>
234323
#include <vector>
235324
#endif
@@ -483,7 +572,7 @@ template<typename T>
483572
auto Typeid() -> decltype(auto) {
484573
#ifdef CPP2_NO_RTTI
485574
Type.expects(
486-
!"'any' dynamic casting is disabled with -fno-rtti", // more likely to appear on console
575+
!"'any' dynamic casting is disabled with -fno-rtti", // more likely to appear on console
487576
"'any' dynamic casting is disabled with -fno-rtti" // make message available to hooked handlers
488577
);
489578
#else
@@ -829,7 +918,7 @@ inline auto to_string(std::string const& s) -> std::string const&
829918

830919
template<typename T>
831920
inline auto to_string(T const& sv) -> std::string
832-
requires (std::is_convertible_v<T, std::string_view>
921+
requires (std::is_convertible_v<T, std::string_view>
833922
&& !std::is_convertible_v<T, const char*>)
834923
{
835924
return std::string{sv};
@@ -969,17 +1058,17 @@ auto is( X const& ) -> bool {
9691058

9701059
template< typename C, typename X >
9711060
requires (
972-
( std::is_base_of_v<X, C> ||
973-
( std::is_polymorphic_v<C> && std::is_polymorphic_v<X>)
1061+
( std::is_base_of_v<X, C> ||
1062+
( std::is_polymorphic_v<C> && std::is_polymorphic_v<X>)
9741063
) && !std::is_same_v<C,X>)
9751064
auto is( X const& x ) -> bool {
9761065
return Dynamic_cast<C const*>(&x) != nullptr;
9771066
}
9781067

9791068
template< typename C, typename X >
9801069
requires (
981-
( std::is_base_of_v<X, C> ||
982-
( std::is_polymorphic_v<C> && std::is_polymorphic_v<X>)
1070+
( std::is_base_of_v<X, C> ||
1071+
( std::is_polymorphic_v<C> && std::is_polymorphic_v<X>)
9831072
) && !std::is_same_v<C,X>)
9841073
auto is( X const* x ) -> bool {
9851074
return Dynamic_cast<C const*>(x) != nullptr;
@@ -1610,7 +1699,7 @@ constexpr auto unsafe_narrow( X&& x ) noexcept -> decltype(auto)
16101699
// Returns a function object that takes a 'value' of the same type as
16111700
// 'flags', and evaluates to true if and only if 'value' has set all of
16121701
// the bits set in 'flags'
1613-
//
1702+
//
16141703
//-----------------------------------------------------------------------
16151704
//
16161705
template <typename T>

0 commit comments

Comments
 (0)