update ArxContainer to v0.3.9
parent
4514d46dbb
commit
a7fb95ce81
@ -0,0 +1,29 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef ARX_TYPE_TRAITS_HAS_INCLUDE_H
|
||||||
|
#define ARX_TYPE_TRAITS_HAS_INCLUDE_H
|
||||||
|
|
||||||
|
// Check whether __has_include is available, but also check the GCC
|
||||||
|
// version (__has_include was introduced in gcc 5) to catch
|
||||||
|
// environments (such as ESP8266) where gcc is old, but some system
|
||||||
|
// header provides a fake __has_include. We also need to check
|
||||||
|
// against __clang__ here, since clang pretends to be GCC
|
||||||
|
// 4.something and would otherwise be detected incorrectly here...
|
||||||
|
#if !defined(__has_include) || defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__)
|
||||||
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
|
// ESP8266 does not have a working __has_include, but we
|
||||||
|
// know it does have a working libstdc++ with all the
|
||||||
|
// headers we care about, so provide a fake has_include
|
||||||
|
#define ARX_SYSTEM_HAS_INCLUDE(x) 1
|
||||||
|
#elif defined(ARDUINO_SAM_DUE)
|
||||||
|
// Arduino DUE's GCC version is 4.8.3 (GCC < 5.0).
|
||||||
|
// And it has not libstdc++
|
||||||
|
#define ARX_SYSTEM_HAS_INCLUDE(x) 0
|
||||||
|
#else
|
||||||
|
#error "Compiler does not support __has_include, please report a bug against the ArxTypeTraits library about this."
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define ARX_SYSTEM_HAS_INCLUDE(x) __has_include(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // ARX_TYPE_TRAITS_HAS_INCLUDE_H
|
@ -0,0 +1,25 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef ARX_TYPE_TRAITS_HAS_LIBSTDCPLUSPLUS_H
|
||||||
|
#define ARX_TYPE_TRAITS_HAS_LIBSTDCPLUSPLUS_H
|
||||||
|
|
||||||
|
#if !defined(ARX_HAVE_LIBSTDCPLUSPLUS)
|
||||||
|
#if ARX_SYSTEM_HAS_INCLUDE(<cstdlib>)
|
||||||
|
#include <cstdlib>
|
||||||
|
#if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION)
|
||||||
|
// For gcc's libstdc++ and clang's libc++, assume that
|
||||||
|
// __cplusplus tells us what the standard includes support
|
||||||
|
#define ARX_HAVE_LIBSTDCPLUSPLUS __cplusplus
|
||||||
|
#elif defined(__UCLIBCXX_MAJOR__)
|
||||||
|
// For uclibc++, assume C++98 support only.
|
||||||
|
#define ARX_HAVE_LIBSTDCPLUSPLUS 199711L
|
||||||
|
#else
|
||||||
|
#error "Unknown C++ library found, please report a bug against the ArxTypeTraits library about this."
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
// Assume no standard library is available at all (e.g. on AVR)
|
||||||
|
#define ARX_HAVE_LIBSTDCPLUSPLUS 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // ARX_TYPE_TRAITS_HAS_LIBSTDCPLUSPLUS_H
|
@ -0,0 +1,30 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef ARX_TYPE_TRAITS_INITIALIZER_H
|
||||||
|
#define ARX_TYPE_TRAITS_INITIALIZER_H
|
||||||
|
|
||||||
|
// Initializer_list *must* be defined in std, so take extra care to only
|
||||||
|
// define it when <initializer_list> is really not available (e.g.
|
||||||
|
// ArduinoSTL is C++98 but *does* define <initializer_list>) and not
|
||||||
|
// already defined (e.g. by ArxContainer).
|
||||||
|
#if __has_include(<initializer_list>)
|
||||||
|
#include <initializer_list>
|
||||||
|
#else
|
||||||
|
namespace std {
|
||||||
|
template<class T>
|
||||||
|
class initializer_list
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
const T* array;
|
||||||
|
size_t len;
|
||||||
|
initializer_list(const T* a, size_t l) : array(a), len(l) {}
|
||||||
|
public:
|
||||||
|
initializer_list() : array(nullptr), len(0) {}
|
||||||
|
size_t size() const { return len; }
|
||||||
|
const T *begin() const { return array; }
|
||||||
|
const T *end() const { return array + len; }
|
||||||
|
};
|
||||||
|
} // namespace std
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // ARX_TYPE_TRAITS_INITIALIZER_LIST_H
|
@ -0,0 +1,33 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef ARX_TYPE_TRAITS_REPLACE_MINMAX_MACROS_H
|
||||||
|
#define ARX_TYPE_TRAITS_REPLACE_MINMAX_MACROS_H
|
||||||
|
|
||||||
|
// Make sure Arduino.h is actually included, since otherwise it might be
|
||||||
|
// included later and break *uses* of the min/max methods, rather than
|
||||||
|
// the declarations of it.
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
// These macros are defined by Arduino.h on some platforms, and conflict
|
||||||
|
// with min/max methods defined or included by ArxTypeTraits, so replace
|
||||||
|
// them with macros here.
|
||||||
|
#ifdef max
|
||||||
|
#undef max
|
||||||
|
template <typename T1, typename T2>
|
||||||
|
constexpr auto max(T1 x, T2 y)
|
||||||
|
-> decltype(x + y)
|
||||||
|
{
|
||||||
|
return (x > y) ? x : y;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef min
|
||||||
|
#undef min
|
||||||
|
template <typename T1, typename T2>
|
||||||
|
constexpr auto min(T1 x, T2 y)
|
||||||
|
-> decltype(x + y)
|
||||||
|
{
|
||||||
|
return (x < y) ? x : y;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // ARX_TYPE_TRAITS_REPLACE_MINMAX_MACROS_H
|
@ -1,9 +1,9 @@
|
|||||||
name=ArxContainer
|
name=ArxContainer
|
||||||
version=0.3.8
|
version=0.3.9
|
||||||
author=hideakitai
|
author=hideakitai
|
||||||
maintainer=hideakitai
|
maintainer=hideakitai
|
||||||
sentence=C++ container-like classes (vector, map, etc.) for Arduino which cannot use STL
|
sentence=C++ container-like classes (vector, map, etc.) for Arduino which cannot use STL
|
||||||
paragraph=C++ container-like classes (vector, map, etc.) for Arduino which cannot use STL
|
paragraph=C++ container-like classes (vector, map, etc.) for Arduino which cannot use STL
|
||||||
category=Data Storage
|
category=Data Storage
|
||||||
url=https://github.com/hideakitai
|
url=https://github.com/hideakitai/ArxContainer
|
||||||
architectures=*
|
architectures=*
|
||||||
|
Loading…
Reference in New Issue