Last active
October 17, 2020 08:36
-
-
Save marzer/f455ddcfcdad06afd3ae552ab15abada to your computer and use it in GitHub Desktop.
Example of forward-declaring std types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // example of forward-declaring std types. | |
| // *** don't use this! it's for exposition only! *** | |
| #pragma once | |
| #ifdef __has_include | |
| #define STDFWD_HAS_INCLUDE(header) __has_include(header) | |
| #else | |
| #define STDFWD_HAS_INCLUDE(header) 0 | |
| #endif | |
| #if STDFWD_HAS_INCLUDE(<version>) | |
| #include <version> | |
| #endif | |
| namespace std | |
| { | |
| template <typename> struct hash; | |
| template <typename> struct pointer_traits; | |
| template <typename> struct tuple_size; | |
| template <size_t, typename> struct tuple_element; | |
| template <typename, typename> struct pair; | |
| template <typename, size_t> class array; | |
| template <typename> class optional; | |
| template <typename...> class tuple; | |
| #ifdef __cpp_lib_span | |
| template <typename, size_t> class span; | |
| #endif | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment