Skip to content

Commit f02aad5

Browse files
committed
Extend std C++ include header list (fix #692)
1 parent ba843af commit f02aad5

File tree

1 file changed

+122
-32
lines changed

1 file changed

+122
-32
lines changed

include/cpp2util.h

Lines changed: 122 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -191,47 +191,137 @@
191191
// in our -pure-cpp2 "import std;" simulation mode... if you need this,
192192
// use mixed mode (not -pure-cpp2) and #include all the headers you need
193193
// including this one
194-
//
194+
//
195195
// #include <execution>
196196
#endif
197197

198198
// Otherwise, we're not in -pure-cpp2 and so just #include
199199
// what we need in this header to make this self-contained
200200
#else
201-
#include <type_traits>
202-
#include <new>
203-
#include <memory>
204-
#include <random>
205-
#include <tuple>
206-
#include <string>
207-
#include <string_view>
208-
#include <vector>
209-
#include <span>
210-
#include <iostream>
211-
#include <variant>
212-
#include <any>
213-
#include <optional>
214-
#include <cstddef>
215-
#include <utility>
216-
#include <cstdio>
217-
#include <cstdint>
201+
#include <version> // has the _cpp_* preprocessor defs, include first
218202
#include <algorithm>
203+
#include <any>
204+
#include <array>
205+
#include <atomic>
206+
#ifdef __cpp_lib_barrier
207+
#include <barrier>
208+
#endif
209+
#include <bit>
210+
#include <bitset>
211+
#include <cctype>
212+
#include <charconv>
213+
#include <chrono>
214+
#include <cassert>
215+
#include <cerrno>
216+
#include <cfenv>
217+
#include <cfloat>
218+
#include <cinttypes>
219+
#include <climits>
220+
#include <clocale>
221+
#include <cmath>
222+
#include <codecvt>
219223
#include <compare>
220-
#include <iterator>
224+
#include <complex>
221225
#include <concepts>
222-
#include <system_error>
223-
#include <limits>
224-
226+
#include <condition_variable>
227+
#ifdef __cpp_lib_coroutine
228+
#include <coroutine>
229+
#endif
230+
#include <csetjmp>
231+
#include <csignal>
232+
#include <cstdarg>
233+
#include <cstddef>
234+
#include <cstdint>
235+
#include <cstdio>
236+
#include <cstdlib>
237+
#include <cstring>
238+
#include <ctime>
239+
#if __has_include(<cuchar>)
240+
#include <cuchar>
241+
#endif
242+
#include <cwchar>
243+
#include <cwctype>
244+
#include <deque>
225245
#ifndef CPP2_NO_EXCEPTIONS
226246
#include <exception>
227247
#endif
228-
#ifndef CPP2_NO_RTTI
229-
#include <typeinfo>
248+
#include <filesystem>
249+
#ifdef __cpp_lib_format
250+
#include <format>
230251
#endif
231-
232-
#if defined(CPP2_USE_SOURCE_LOCATION)
252+
#include <forward_list>
253+
#include <fstream>
254+
#include <future>
255+
#include <functional>
256+
#include <initializer_list>
257+
#include <iomanip>
258+
#include <ios>
259+
#include <iosfwd>
260+
#include <iostream>
261+
#include <iso646.h>
262+
#include <istream>
263+
#include <iterator>
264+
#ifdef __cpp_lib_latch
265+
#include <latch>
266+
#endif
267+
#include <limits>
268+
#include <list>
269+
#include <locale>
270+
#include <map>
271+
#include <memory>
272+
#ifdef __cpp_lib_memory_resource
273+
#include <memory_resource>
274+
#endif
275+
#include <mutex>
276+
#include <new>
277+
#include <numbers>
278+
#include <numeric>
279+
#include <optional>
280+
#include <ostream>
281+
#include <queue>
282+
#include <ranges>
283+
#include <random>
284+
#include <ratio>
285+
#include <regex>
286+
#include <scoped_allocator>
287+
#ifdef __cpp_lib_semaphore
288+
#include <semaphore>
289+
#endif
290+
#include <set>
291+
#include <shared_mutex>
292+
#ifdef __cpp_lib_source_location
233293
#include <source_location>
234294
#endif
295+
#include <span>
296+
#ifdef __cpp_lib_spanstream
297+
#include <spanstream>
298+
#endif
299+
#include <stack>
300+
#include <stdexcept>
301+
#include <string>
302+
#include <string_view>
303+
#include <system_error>
304+
#include <sstream>
305+
#ifdef __cpp_lib_jthread
306+
#include <stop_token>
307+
#endif
308+
#include <streambuf>
309+
#ifdef __cpp_lib_syncstream
310+
#include <syncstream>
311+
#endif
312+
#include <thread>
313+
#include <tuple>
314+
#include <type_traits>
315+
#include <typeindex>
316+
#ifndef CPP2_NO_RTTI
317+
#include <typeinfo>
318+
#endif
319+
#include <unordered_map>
320+
#include <unordered_set>
321+
#include <utility>
322+
#include <valarray>
323+
#include <variant>
324+
#include <vector>
235325
#endif
236326

237327

@@ -483,7 +573,7 @@ template<typename T>
483573
auto Typeid() -> decltype(auto) {
484574
#ifdef CPP2_NO_RTTI
485575
Type.expects(
486-
!"'any' dynamic casting is disabled with -fno-rtti", // more likely to appear on console
576+
!"'any' dynamic casting is disabled with -fno-rtti", // more likely to appear on console
487577
"'any' dynamic casting is disabled with -fno-rtti" // make message available to hooked handlers
488578
);
489579
#else
@@ -829,7 +919,7 @@ inline auto to_string(std::string const& s) -> std::string const&
829919

830920
template<typename T>
831921
inline auto to_string(T const& sv) -> std::string
832-
requires (std::is_convertible_v<T, std::string_view>
922+
requires (std::is_convertible_v<T, std::string_view>
833923
&& !std::is_convertible_v<T, const char*>)
834924
{
835925
return std::string{sv};
@@ -952,17 +1042,17 @@ auto is( X const& ) -> bool {
9521042

9531043
template< typename C, typename X >
9541044
requires (
955-
( std::is_base_of_v<X, C> ||
956-
( std::is_polymorphic_v<C> && std::is_polymorphic_v<X>)
1045+
( std::is_base_of_v<X, C> ||
1046+
( std::is_polymorphic_v<C> && std::is_polymorphic_v<X>)
9571047
) && !std::is_same_v<C,X>)
9581048
auto is( X const& x ) -> bool {
9591049
return Dynamic_cast<C const*>(&x) != nullptr;
9601050
}
9611051

9621052
template< typename C, typename X >
9631053
requires (
964-
( std::is_base_of_v<X, C> ||
965-
( std::is_polymorphic_v<C> && std::is_polymorphic_v<X>)
1054+
( std::is_base_of_v<X, C> ||
1055+
( std::is_polymorphic_v<C> && std::is_polymorphic_v<X>)
9661056
) && !std::is_same_v<C,X>)
9671057
auto is( X const* x ) -> bool {
9681058
return Dynamic_cast<C const*>(x) != nullptr;

0 commit comments

Comments
 (0)