17 #ifndef FLATBUFFERS_STL_EMULATION_H_ 18 #define FLATBUFFERS_STL_EMULATION_H_ 23 #include <type_traits> 28 #if defined(_STLPORT_VERSION) && !defined(FLATBUFFERS_CPP98_STL) 29 #define FLATBUFFERS_CPP98_STL 30 #endif // defined(_STLPORT_VERSION) && !defined(FLATBUFFERS_CPP98_STL) 32 #if defined(FLATBUFFERS_CPP98_STL) 34 #endif // defined(FLATBUFFERS_CPP98_STL) 42 return value[value.length() - 1];
46 return value[value.length() - 1];
51 template <
typename T>
inline T *
vector_data(std::vector<T> &vector) {
54 return vector.empty() ?
nullptr : &vector[0];
58 const std::vector<T> &vector) {
59 return vector.empty() ?
nullptr : &vector[0];
62 template <
typename T,
typename V>
64 #if defined(FLATBUFFERS_CPP98_STL) 65 vector->push_back(
data);
67 vector->emplace_back(std::forward<V>(
data));
68 #endif // defined(FLATBUFFERS_CPP98_STL) 71 #ifndef FLATBUFFERS_CPP98_STL 72 #if !(defined(_MSC_VER) && _MSC_VER <= 1700 ) 78 #endif // !(defined(_MSC_VER) && _MSC_VER <= 1700 ) 85 static unsigned long long min() {
return 0ULL; }
86 static unsigned long long max() {
return ~0ULL; }
91 static long long min() {
92 return static_cast<long long>(1ULL << ((
sizeof(
long long) << 3) - 1));
94 static long long max() {
95 return static_cast<long long>(
96 (1ULL << ((
sizeof(
long long) << 3) - 1)) - 1);
99 #endif // FLATBUFFERS_CPP98_STL 101 #if !(defined(_MSC_VER) && _MSC_VER <= 1700 ) 102 #ifndef FLATBUFFERS_CPP98_STL 103 template <
typename T>
using is_scalar = std::is_scalar<T>;
104 template <
typename T,
typename U>
using is_same = std::is_same<T,U>;
109 template <
typename T>
using is_scalar = std::tr1::is_scalar<T>;
110 template <
typename T,
typename U>
using is_same = std::tr1::is_same<T,U>;
112 std::tr1::is_floating_point<T>;
113 template <
typename T>
using is_unsigned = std::tr1::is_unsigned<T>;
114 #endif // !FLATBUFFERS_CPP98_STL 122 #endif // !(defined(_MSC_VER) && _MSC_VER <= 1700 ) 124 #ifndef FLATBUFFERS_CPP98_STL 125 #if !(defined(_MSC_VER) && _MSC_VER <= 1700 ) 136 explicit unique_ptr(T* p) : std::unique_ptr<T>(p) {}
137 unique_ptr(std::unique_ptr<T>&& u) { *
this = std::move(u); }
139 unique_ptr& operator=(std::unique_ptr<T>&& u) {
140 std::unique_ptr<T>::reset(u.release());
144 std::unique_ptr<T>::reset(u.release());
148 return std::unique_ptr<T>::operator=(p);
151 #endif // !(defined(_MSC_VER) && _MSC_VER <= 1700 ) 158 typedef T element_type;
164 reset(const_cast<unique_ptr*>(&u)->release());
166 ~unique_ptr() { reset(); }
168 unique_ptr& operator=(
const unique_ptr& u) {
169 reset(const_cast<unique_ptr*>(&u)->release());
173 unique_ptr& operator=(unique_ptr&& u) {
178 unique_ptr& operator=(T* p) {
183 const T& operator*()
const {
return *ptr_; }
184 T* operator->()
const {
return ptr_; }
185 T*
get()
const noexcept {
return ptr_; }
186 explicit operator bool()
const {
return ptr_ !=
nullptr; }
195 void reset(T* p =
nullptr) {
198 if (value)
delete value;
201 void swap(unique_ptr& u) {
213 return x.get() == y.get();
218 return static_cast<D*
>(x.get()) == y;
222 return reinterpret_cast<intptr_t
>(x.get()) == y;
224 #endif // !FLATBUFFERS_CPP98_STL 228 #endif // FLATBUFFERS_STL_EMULATION_H_ const T * data(const std::vector< T, Alloc > &v)
std::is_unsigned< T > is_unsigned
void swap(linb::any &lhs, linb::any &rhs) noexcept
T * vector_data(std::vector< T > &vector)
std::unique_ptr< T > unique_ptr
optional_constexpr bool operator==(optional< T > const &x, optional< U > const &y)
std::numeric_limits< T > numeric_limits
std::is_floating_point< T > is_floating_point
std::is_scalar< T > is_scalar
std::is_same< T, U > is_same
void vector_emplace_back(std::vector< T > *vector, V &&data)
char & string_back(std::string &value)