|
3 | 3 | #define CXXGraph_VERSION_MINOR @CXXGraph_VERSION_MINOR@ |
4 | 4 | #define CXXGraph_VERSION_PATCH @CXXGraph_VERSION_PATCH@ |
5 | 5 |
|
6 | | -#include <string_view> |
7 | | - |
8 | | -#if defined(CXXGraph_CUSTOM_MAP) || defined(CXXGraph_CUSTOM_MAP_HEADER) |
| 6 | +#pragma once |
| 7 | +#if defined(CXXGraph_CUSTOM_MAP_HEADER) |
9 | 8 | // Very custom types, not explictly supported. |
10 | 9 | // Should be usable as a replacement std::unordered_map and set. |
11 | | -# if !__has_include( CXXGraph_CUSTOM_MAP_HEADER ) |
12 | | -# error "CXXGraph_CUSTOM_MAP is defined but CXXGraph_CUSTOM_MAP_HEADER is not valid" |
13 | | -# elif !defined(CXXGraph_CUSTOM_MAP) |
14 | | -# error "CXXGraph_CUSTOM_MAP is defined but CXXGraph_CUSTOM_MAP is not set." |
| 10 | +# if defined(CXXGraph_NO_CUSTOM_MAP_HEADER_INCLUDE) |
| 11 | +// User does not want us to include the custom map header |
| 12 | +// They might not want to define lots of macros |
| 13 | +// They will have to do all the includes themselves |
| 14 | +# elif !__has_include( CXXGraph_CUSTOM_MAP_HEADER ) |
| 15 | +# error "CXXGraph_CUSTOM_MAP_HEADER is defined but is not a valid include path. \ |
| 16 | +Use CXXGraph_NO_CUSTOM_MAP_HEADER_INCLUDE to disable this check" |
15 | 17 | # else |
| 18 | +// If one include is fine, assume the rest are also fine. |
16 | 19 | # include CXXGraph_CUSTOM_MAP_HEADER |
17 | 20 | # include CXXGraph_CUSTOM_SET_HEADER |
18 | 21 | # include CXXGraph_CUSTOM_ORDERED_SET_HEADER |
19 | 22 | # include CXXGraph_CUSTOM_ORDERED_MAP_HEADER |
20 | | - |
21 | | - namespace CXXGraph { |
22 | | - template<typename Key, typename Value, typename... Args> |
23 | | - using Map = CXXGraph_CUSTOM_MAP<Key, Value, Args...>; |
24 | | - template<typename Key, typename Value, typename... Args> |
25 | | - using OrderedMap = CXXGraph_CUSTOM_ORDERED_MAP<Key, Value, Args...>; |
26 | | - template<typename Key, typename... Args> |
27 | | - using OrderedSet = CXXGraph_CUSTOM_ORDERED_SET<Key, Args...>; |
28 | | - template<typename Key, typename... Args> |
29 | | - using Set = CXXGraph_CUSTOM_SET<Key, Args...>; |
30 | | - } |
| 23 | +// Users are expected to declare types in our namespace (saves us gessing what they are) |
31 | 24 | # endif |
32 | 25 | #elif __has_include(<frozen/set.h>) |
| 26 | +// Frozen library is available, use it for better performance |
33 | 27 | # include <frozen/set.h> |
34 | 28 | # include <frozen/unordered_set.h> |
35 | 29 | # include <frozen/unordered_map.h> |
|
0 commit comments