1 /*
2  * Copyright (c) Facebook, Inc. and its affiliates.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #if defined(__has_include) && __cplusplus >= 201703L
20 
21 #if __has_include(<memory_resource>)
22 
23 #define FOLLY_HAS_MEMORY_RESOURCE 1
24 #include <memory_resource> // @manual
25 namespace folly {
26 namespace detail {
27 namespace std_pmr = ::std::pmr;
28 } // namespace detail
29 } // namespace folly
30 
31 // Ignore experimental/memory_resource for libc++ so that all programs
32 // don't need to explicitly link the c++experimental lib
33 #elif !defined(_LIBCPP_VERSION) && __has_include(<experimental/memory_resource>)
34 
35 #define FOLLY_HAS_MEMORY_RESOURCE 1
36 #include <experimental/memory_resource> // @manual
37 namespace folly {
38 namespace detail {
39 namespace std_pmr = ::std::experimental::pmr;
40 } // namespace detail
41 } // namespace folly
42 
43 #else
44 
45 #define FOLLY_HAS_MEMORY_RESOURCE 0
46 
47 #endif
48 
49 #else // __has_include
50 
51 #define FOLLY_HAS_MEMORY_RESOURCE 0
52 
53 #endif // __has_include
54