-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathArxSmartPtr.h
46 lines (37 loc) · 1.36 KB
/
ArxSmartPtr.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once
#ifndef ARX_SMART_PTR_H
#define ARX_SMART_PTR_H
#ifdef ARDUINO
#include <Arduino.h>
#endif
#include "ArxSmartPtr/detail/has_include.h"
#include "ArxSmartPtr/detail/has_libstdcplusplus.h"
// Make sure std namespace exists
namespace std { }
// Import everything from the std namespace into arx::std, so that
// anything we import rather than define is also available through
// arx::stdx.
// This includes everything yet to be defined, so we can do this early
// (and must do so, to allow e.g. the C++14 additions in the arx::std
// namespace to reference the C++11 stuff from the system headers.
namespace arx {
namespace stdx {
using namespace ::std;
}
}
// Import everything from arx::std back into the normal std namespace.
// This ensures that you can just use `std::foo` everywhere and you get
// the standard library version if it is available, falling back to arx
// versions for things not supplied by the standard library. Only when
// you really need the arx version (e.g. for constexpr numeric_limits
// when also using ArduinoSTL), you need to qualify with arx::stdx::
namespace std {
using namespace ::arx::stdx;
}
#include "ArxSmartPtr/detail/replace_minmax_macros.h"
#if ARX_HAVE_LIBSTDCPLUSPLUS >= 201103L // Have libstdc++11
#include <memory>
#else
#include "ArxSmartPtr/shared_ptr.h"
#endif
#endif // ARX_SMART_PTR_H