Skip to content

Commit 35f09aa

Browse files
committed
3.01.00 release
1 parent 124048e commit 35f09aa

File tree

16 files changed

+356
-48
lines changed

16 files changed

+356
-48
lines changed
File renamed without changes.

include/EASTL/bonus/list_map.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ namespace eastl
315315
insert_return_type insert(const value_type& value) = delete;
316316
iterator insert(const_iterator position, const value_type& value) = delete;
317317

318-
template <typename InputIterator>
318+
template <typename InputIterator>
319319
void insert(InputIterator first, InputIterator last) = delete;
320320

321321
insert_return_type insert(const key_type& key) = delete;

include/EASTL/chrono.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
#include <mach/mach_time.h>
5252
#elif defined(EA_PLATFORM_POSIX) || defined(EA_PLATFORM_MINGW) // Posix means Linux, Unix, and Macintosh OSX, among others (including Linux-based mobile platforms).
5353
#if defined(EA_PLATFORM_MINGW)
54-
#include <pthread_time.h>
54+
#include <pthread_time.h>
5555
#endif
5656
#if (defined(CLOCK_REALTIME) || defined(CLOCK_MONOTONIC))
5757
#include <time.h>

include/EASTL/internal/config.h

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@
105105
///////////////////////////////////////////////////////////////////////////////
106106

107107
#ifndef EASTL_VERSION
108-
#define EASTL_VERSION "3.00.00"
109-
#define EASTL_VERSION_N 30000
108+
#define EASTL_VERSION "3.01.00"
109+
#define EASTL_VERSION_N 30100
110110
#endif
111111

112112

@@ -585,42 +585,59 @@ namespace eastl
585585

586586

587587
///////////////////////////////////////////////////////////////////////////////
588-
// EASTL_DEBUG_BREAK
588+
// EASTL_DEBUG_BREAK / EASTL_DEBUG_BREAK_OVERRIDE
589589
//
590590
// This function causes an app to immediately stop under the debugger.
591591
// It is implemented as a macro in order to allow stopping at the site
592592
// of the call.
593593
//
594+
// EASTL_DEBUG_BREAK_OVERRIDE allows one to define EASTL_DEBUG_BREAK directly.
595+
// This is useful in cases where you desire to disable EASTL_DEBUG_BREAK
596+
// but do not wish to (or cannot) define a custom void function() to replace
597+
// EASTL_DEBUG_BREAK callsites.
594598
//
595599
// Example usage:
596600
// EASTL_DEBUG_BREAK();
597601
//
598602
///////////////////////////////////////////////////////////////////////////////
599603

600-
#ifndef EASTL_DEBUG_BREAK
601-
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
602-
#define EASTL_DEBUG_BREAK() __debugbreak() // This is a compiler intrinsic which will map to appropriate inlined asm for the platform.
603-
#elif (defined(EA_PROCESSOR_ARM) && !defined(EA_PROCESSOR_ARM64)) && defined(__APPLE__)
604-
#define EASTL_DEBUG_BREAK() asm("trap")
605-
#elif defined(EA_PROCESSOR_ARM64) && defined(__APPLE__)
606-
#include <signal.h>
607-
#include <unistd.h>
608-
#define EASTL_DEBUG_BREAK() kill( getpid(), SIGINT )
609-
#elif defined(EA_PROCESSOR_ARM) && defined(__GNUC__)
610-
#define EASTL_DEBUG_BREAK() asm("BKPT 10") // The 10 is arbitrary. It's just a unique id.
611-
#elif defined(EA_PROCESSOR_ARM) && defined(__ARMCC_VERSION)
612-
#define EASTL_DEBUG_BREAK() __breakpoint(10)
613-
#elif defined(EA_PROCESSOR_POWERPC) // Generic PowerPC.
614-
#define EASTL_DEBUG_BREAK() asm(".long 0") // This triggers an exception by executing opcode 0x00000000.
615-
#elif (defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64)) && defined(EA_ASM_STYLE_INTEL)
616-
#define EASTL_DEBUG_BREAK() { __asm int 3 }
617-
#elif (defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64)) && (defined(EA_ASM_STYLE_ATT) || defined(__GNUC__))
618-
#define EASTL_DEBUG_BREAK() asm("int3")
619-
#else
620-
void EASTL_DEBUG_BREAK(); // User must define this externally.
621-
#endif
604+
#ifndef EASTL_DEBUG_BREAK_OVERRIDE
605+
#ifndef EASTL_DEBUG_BREAK
606+
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
607+
#define EASTL_DEBUG_BREAK() __debugbreak() // This is a compiler intrinsic which will map to appropriate inlined asm for the platform.
608+
#elif (defined(EA_PROCESSOR_ARM) && !defined(EA_PROCESSOR_ARM64)) && defined(__APPLE__)
609+
#define EASTL_DEBUG_BREAK() asm("trap")
610+
#elif defined(EA_PROCESSOR_ARM64) && defined(__APPLE__)
611+
#include <signal.h>
612+
#include <unistd.h>
613+
#define EASTL_DEBUG_BREAK() kill( getpid(), SIGINT )
614+
#elif defined(EA_PROCESSOR_ARM) && defined(__GNUC__)
615+
#define EASTL_DEBUG_BREAK() asm("BKPT 10") // The 10 is arbitrary. It's just a unique id.
616+
#elif defined(EA_PROCESSOR_ARM) && defined(__ARMCC_VERSION)
617+
#define EASTL_DEBUG_BREAK() __breakpoint(10)
618+
#elif defined(EA_PROCESSOR_POWERPC) // Generic PowerPC.
619+
#define EASTL_DEBUG_BREAK() asm(".long 0") // This triggers an exception by executing opcode 0x00000000.
620+
#elif (defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64)) && defined(EA_ASM_STYLE_INTEL)
621+
#define EASTL_DEBUG_BREAK() { __asm int 3 }
622+
#elif (defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64)) && (defined(EA_ASM_STYLE_ATT) || defined(__GNUC__))
623+
#define EASTL_DEBUG_BREAK() asm("int3")
624+
#else
625+
void EASTL_DEBUG_BREAK(); // User must define this externally.
626+
#endif
627+
#else
628+
void EASTL_DEBUG_BREAK(); // User must define this externally.
629+
#endif
622630
#else
623-
void EASTL_DEBUG_BREAK(); // User must define this externally.
631+
#ifndef EASTL_DEBUG_BREAK
632+
#if EASTL_DEBUG_BREAK_OVERRIDE == 1
633+
// define an empty callable to satisfy the call site.
634+
#define EASTL_DEBUG_BREAK ([]{})
635+
#else
636+
#define EASTL_DEBUG_BREAK EASTL_DEBUG_BREAK_OVERRIDE
637+
#endif
638+
#else
639+
#error EASTL_DEBUG_BREAK is already defined yet you would like to override it. Please ensure no other headers are already defining EASTL_DEBUG_BREAK before this header (config.h) is included
640+
#endif
624641
#endif
625642

626643

@@ -1451,7 +1468,7 @@ namespace eastl
14511468
///////////////////////////////////////////////////////////////////////////////
14521469
// EA_COMPILER_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS undef
14531470
//
1454-
// We need revise this macro to be unefined in some cases, in case the user
1471+
// We need revise this macro to be undefined in some cases, in case the user
14551472
// isn't using an updated EABase.
14561473
///////////////////////////////////////////////////////////////////////////////
14571474
#if defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403) // It may in fact be supported by 4.01 or 4.02 but we don't have compilers to test with.
@@ -1763,11 +1780,18 @@ typedef EASTL_SSIZE_T eastl_ssize_t; // Signed version of eastl_size_t. Concept
17631780
/// EASTL_OPENSOURCE
17641781
/// This is enabled when EASTL is building built in an "open source" mode. Which is a mode that eliminates code
17651782
/// dependencies on other technologies that have not been released publically.
1766-
/// EASTL_OPENSOURCE = 0, is the default.
1783+
/// EASTL_OPENSOURCE = 0, is the default.
17671784
/// EASTL_OPENSOURCE = 1, utilizes technologies that not publically available.
17681785
///
17691786
#ifndef EASTL_OPENSOURCE
17701787
#define EASTL_OPENSOURCE 0
17711788
#endif
17721789

17731790
#endif // Header include guard
1791+
1792+
1793+
1794+
1795+
1796+
1797+

include/EASTL/internal/red_black_tree.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,13 @@ namespace eastl
112112
//
113113
// Potentially we could provide a constructor that would satisfy the compiler and change the code to use this constructor
114114
// instead of constructing mValue in place within an unconstructed rbtree_node.
115-
#if !defined(EA_COMPILER_NO_DELETED_FUNCTIONS)
116-
rbtree_node(const rbtree_node&) = delete;
117-
#else
118-
private:
119-
rbtree_node(const rbtree_node&);
115+
#if defined(_MSC_VER)
116+
#if !defined(EA_COMPILER_NO_DELETED_FUNCTIONS)
117+
rbtree_node(const rbtree_node&) = delete;
118+
#else
119+
private:
120+
rbtree_node(const rbtree_node&);
121+
#endif
120122
#endif
121123
};
122124

include/EASTL/internal/type_transformations.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,16 @@ namespace eastl
4545
template <typename T>
4646
struct add_const
4747
{ typedef typename eastl::add_const_helper<T>::type type; };
48-
48+
49+
// add_const_t is the C++17 using typedef for typename add_const<T>::type.
50+
// We provide a backwards-compatible means to access it through a macro for pre-C++11 compilers.
51+
#if defined(EA_COMPILER_NO_TEMPLATE_ALIASES)
52+
#define EASTL_ADD_CONST_T(T) typename add_const<T>::type
53+
#else
54+
template <typename T>
55+
using add_const_t = typename add_const<T>::type;
56+
#define EASTL_ADD_CONST_T(T) add_const_t<T>
57+
#endif
4958

5059

5160
///////////////////////////////////////////////////////////////////////

include/EASTL/map.h

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ namespace eastl
120120
map(const Compare& compare, const allocator_type& allocator = EASTL_MAP_DEFAULT_ALLOCATOR);
121121
map(const this_type& x);
122122
#if EASTL_MOVE_SEMANTICS_ENABLED
123-
map(this_type&& x);
124-
map(this_type&& x, const allocator_type& allocator);
123+
map(this_type&& x);
124+
map(this_type&& x, const allocator_type& allocator);
125125
#endif
126126
map(std::initializer_list<value_type> ilist, const Compare& compare = Compare(), const allocator_type& allocator = EASTL_MAP_DEFAULT_ALLOCATOR);
127127

@@ -151,6 +151,9 @@ namespace eastl
151151
eastl::pair<const_iterator, const_iterator> equal_range(const Key& key) const;
152152

153153
T& operator[](const Key& key); // Of map, multimap, set, and multimap, only map has operator[].
154+
#if EASTL_MOVE_SEMANTICS_ENABLED
155+
T& operator[](Key&& key);
156+
#endif
154157

155158
}; // map
156159

@@ -416,6 +419,26 @@ namespace eastl
416419
}
417420

418421

422+
#if EASTL_MOVE_SEMANTICS_ENABLED
423+
template <typename Key, typename T, typename Compare, typename Allocator>
424+
inline T& map<Key, T, Compare, Allocator>::operator[](Key&& key)
425+
{
426+
iterator itLower(lower_bound(key)); // itLower->first is >= key.
427+
428+
if((itLower == end()) || mCompare(key, (*itLower).first))
429+
{
430+
itLower = base_type::DoInsertKey(true_type(), itLower, eastl::move(key));
431+
}
432+
433+
return (*itLower).second;
434+
435+
// Reference implementation of this function, which may not be as fast:
436+
//iterator it(base_type::insert(eastl::pair<iterator, iterator>(key, T())).first);
437+
//return it->second;
438+
}
439+
#endif
440+
441+
419442

420443

421444

include/EASTL/string.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4017,6 +4017,62 @@ namespace eastl
40174017
};
40184018
#endif
40194019

4020+
4021+
/// to_string
4022+
///
4023+
/// Converts integral types to an eastl::string with the same content that sprintf produces. The following
4024+
/// implementation provides a type safe conversion mechanism which avoids the common bugs associated with sprintf
4025+
/// style format strings.
4026+
///
4027+
/// http://en.cppreference.com/w/cpp/string/basic_string/to_string
4028+
///
4029+
inline string to_string(int value)
4030+
{ return string(string::CtorSprintf(), "%d", value); }
4031+
inline string to_string(long value)
4032+
{ return string(string::CtorSprintf(), "%ld", value); }
4033+
inline string to_string(long long value)
4034+
{ return string(string::CtorSprintf(), "%lld", value); }
4035+
inline string to_string(unsigned value)
4036+
{ return string(string::CtorSprintf(), "%u", value); }
4037+
inline string to_string(unsigned long value)
4038+
{ return string(string::CtorSprintf(), "%lu", value); }
4039+
inline string to_string(unsigned long long value)
4040+
{ return string(string::CtorSprintf(), "%llu", value); }
4041+
inline string to_string(float value)
4042+
{ return string(string::CtorSprintf(), "%f", value); }
4043+
inline string to_string(double value)
4044+
{ return string(string::CtorSprintf(), "%f", value); }
4045+
inline string to_string(long double value)
4046+
{ return string(string::CtorSprintf(), "%Lf", value); }
4047+
4048+
4049+
/// to_wstring
4050+
///
4051+
/// Converts integral types to an eastl::wstring with the same content that sprintf produces. The following
4052+
/// implementation provides a type safe conversion mechanism which avoids the common bugs associated with sprintf
4053+
/// style format strings.
4054+
///
4055+
/// http://en.cppreference.com/w/cpp/string/basic_string/to_wstring
4056+
///
4057+
inline wstring to_wstring(int value)
4058+
{ return wstring(wstring::CtorSprintf(), L"%d", value); }
4059+
inline wstring to_wstring(long value)
4060+
{ return wstring(wstring::CtorSprintf(), L"%ld", value); }
4061+
inline wstring to_wstring(long long value)
4062+
{ return wstring(wstring::CtorSprintf(), L"%lld", value); }
4063+
inline wstring to_wstring(unsigned value)
4064+
{ return wstring(wstring::CtorSprintf(), L"%u", value); }
4065+
inline wstring to_wstring(unsigned long value)
4066+
{ return wstring(wstring::CtorSprintf(), L"%lu", value); }
4067+
inline wstring to_wstring(unsigned long long value)
4068+
{ return wstring(wstring::CtorSprintf(), L"%llu", value); }
4069+
inline wstring to_wstring(float value)
4070+
{ return wstring(wstring::CtorSprintf(), L"%f", value); }
4071+
inline wstring to_wstring(double value)
4072+
{ return wstring(wstring::CtorSprintf(), L"%f", value); }
4073+
inline wstring to_wstring(long double value)
4074+
{ return wstring(wstring::CtorSprintf(), L"%Lf", value); }
4075+
40204076
} // namespace eastl
40214077

40224078

include/EASTL/type_traits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ namespace eastl
334334
// in template metaprogramming.
335335
//
336336
// Example usage:
337-
// typedef ChosenType = type_select<is_integral<SomeType>::value, ChoiceAType, ChoiceBType>::type;
337+
// typedef ChosenType = typename type_select<is_integral<SomeType>::value, ChoiceAType, ChoiceBType>::type;
338338
//
339339
template <bool bCondition, class ConditionIsTrueType, class ConditionIsFalseType>
340340
struct type_select { typedef ConditionIsTrueType type; };

include/EASTL/utility.h

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,53 @@ namespace eastl
213213
eastl::swap_ranges(a, a + N, b);
214214
}
215215

216+
/// exchange
217+
///
218+
/// Replaces the value of the first argument with the new value provided.
219+
/// The return value is the previous value of first argument.
220+
///
221+
/// http://en.cppreference.com/w/cpp/utility/exchange
222+
///
223+
#if defined(EA_COMPILER_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS)
224+
template <typename T, typename U>
225+
inline T exchange(T& obj, U&& new_value, typename eastl::enable_if<eastl::is_convertible<U, T>::value>::type* = 0)
226+
{
227+
T old_value = eastl::move(obj);
228+
obj = eastl::forward<U>(new_value);
229+
return old_value;
230+
}
231+
#else
232+
template <typename T, typename U = T>
233+
inline T exchange(T& obj, U&& new_value)
234+
{
235+
T old_value = eastl::move(obj);
236+
obj = eastl::forward<U>(new_value);
237+
return old_value;
238+
}
239+
#endif
216240

217-
///////////////////////////////////////////////////////////////////////
241+
/// as_const
242+
///
243+
/// Converts a 'T&' into a 'const T&' which simplifies calling const functions on non-const objects.
244+
///
245+
/// http://en.cppreference.com/w/cpp/utility/as_const
246+
///
247+
/// C++ proposal paper:
248+
/// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4380.html
249+
///
250+
template <class T>
251+
EA_CONSTEXPR typename eastl::add_const<T>::type& as_const(T& t) EA_NOEXCEPT
252+
{ return t; }
253+
254+
// The C++17 forbids 'eastl::as_const' from accepting rvalues. Passing an rvalue reference to 'eastl::as_const'
255+
// generates an 'const T&' or const lvalue reference to a temporary object.
256+
#if !defined(EA_COMPILER_NO_DELETED_FUNCTIONS)
257+
template <class T>
258+
void as_const(const T&&) = delete;
259+
#endif
260+
261+
262+
///////////////////////////////////////////////////////////////////////
218263
/// rel_ops
219264
///
220265
/// rel_ops allow the automatic generation of operators !=, >, <=, >= from

0 commit comments

Comments
 (0)