Skip to content

Commit

Permalink
3.01.00 release
Browse files Browse the repository at this point in the history
  • Loading branch information
rparolin committed Apr 4, 2016
1 parent 124048e commit 35f09aa
Show file tree
Hide file tree
Showing 16 changed files with 356 additions and 48 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion include/EASTL/bonus/list_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ namespace eastl
insert_return_type insert(const value_type& value) = delete;
iterator insert(const_iterator position, const value_type& value) = delete;

template <typename InputIterator>
template <typename InputIterator>
void insert(InputIterator first, InputIterator last) = delete;

insert_return_type insert(const key_type& key) = delete;
Expand Down
2 changes: 1 addition & 1 deletion include/EASTL/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#include <mach/mach_time.h>
#elif defined(EA_PLATFORM_POSIX) || defined(EA_PLATFORM_MINGW) // Posix means Linux, Unix, and Macintosh OSX, among others (including Linux-based mobile platforms).
#if defined(EA_PLATFORM_MINGW)
#include <pthread_time.h>
#include <pthread_time.h>
#endif
#if (defined(CLOCK_REALTIME) || defined(CLOCK_MONOTONIC))
#include <time.h>
Expand Down
80 changes: 52 additions & 28 deletions include/EASTL/internal/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@
///////////////////////////////////////////////////////////////////////////////

#ifndef EASTL_VERSION
#define EASTL_VERSION "3.00.00"
#define EASTL_VERSION_N 30000
#define EASTL_VERSION "3.01.00"
#define EASTL_VERSION_N 30100
#endif


Expand Down Expand Up @@ -585,42 +585,59 @@ namespace eastl


///////////////////////////////////////////////////////////////////////////////
// EASTL_DEBUG_BREAK
// EASTL_DEBUG_BREAK / EASTL_DEBUG_BREAK_OVERRIDE
//
// This function causes an app to immediately stop under the debugger.
// It is implemented as a macro in order to allow stopping at the site
// of the call.
//
// EASTL_DEBUG_BREAK_OVERRIDE allows one to define EASTL_DEBUG_BREAK directly.
// This is useful in cases where you desire to disable EASTL_DEBUG_BREAK
// but do not wish to (or cannot) define a custom void function() to replace
// EASTL_DEBUG_BREAK callsites.
//
// Example usage:
// EASTL_DEBUG_BREAK();
//
///////////////////////////////////////////////////////////////////////////////

#ifndef EASTL_DEBUG_BREAK
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
#define EASTL_DEBUG_BREAK() __debugbreak() // This is a compiler intrinsic which will map to appropriate inlined asm for the platform.
#elif (defined(EA_PROCESSOR_ARM) && !defined(EA_PROCESSOR_ARM64)) && defined(__APPLE__)
#define EASTL_DEBUG_BREAK() asm("trap")
#elif defined(EA_PROCESSOR_ARM64) && defined(__APPLE__)
#include <signal.h>
#include <unistd.h>
#define EASTL_DEBUG_BREAK() kill( getpid(), SIGINT )
#elif defined(EA_PROCESSOR_ARM) && defined(__GNUC__)
#define EASTL_DEBUG_BREAK() asm("BKPT 10") // The 10 is arbitrary. It's just a unique id.
#elif defined(EA_PROCESSOR_ARM) && defined(__ARMCC_VERSION)
#define EASTL_DEBUG_BREAK() __breakpoint(10)
#elif defined(EA_PROCESSOR_POWERPC) // Generic PowerPC.
#define EASTL_DEBUG_BREAK() asm(".long 0") // This triggers an exception by executing opcode 0x00000000.
#elif (defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64)) && defined(EA_ASM_STYLE_INTEL)
#define EASTL_DEBUG_BREAK() { __asm int 3 }
#elif (defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64)) && (defined(EA_ASM_STYLE_ATT) || defined(__GNUC__))
#define EASTL_DEBUG_BREAK() asm("int3")
#else
void EASTL_DEBUG_BREAK(); // User must define this externally.
#endif
#ifndef EASTL_DEBUG_BREAK_OVERRIDE
#ifndef EASTL_DEBUG_BREAK
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
#define EASTL_DEBUG_BREAK() __debugbreak() // This is a compiler intrinsic which will map to appropriate inlined asm for the platform.
#elif (defined(EA_PROCESSOR_ARM) && !defined(EA_PROCESSOR_ARM64)) && defined(__APPLE__)
#define EASTL_DEBUG_BREAK() asm("trap")
#elif defined(EA_PROCESSOR_ARM64) && defined(__APPLE__)
#include <signal.h>
#include <unistd.h>
#define EASTL_DEBUG_BREAK() kill( getpid(), SIGINT )
#elif defined(EA_PROCESSOR_ARM) && defined(__GNUC__)
#define EASTL_DEBUG_BREAK() asm("BKPT 10") // The 10 is arbitrary. It's just a unique id.
#elif defined(EA_PROCESSOR_ARM) && defined(__ARMCC_VERSION)
#define EASTL_DEBUG_BREAK() __breakpoint(10)
#elif defined(EA_PROCESSOR_POWERPC) // Generic PowerPC.
#define EASTL_DEBUG_BREAK() asm(".long 0") // This triggers an exception by executing opcode 0x00000000.
#elif (defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64)) && defined(EA_ASM_STYLE_INTEL)
#define EASTL_DEBUG_BREAK() { __asm int 3 }
#elif (defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64)) && (defined(EA_ASM_STYLE_ATT) || defined(__GNUC__))
#define EASTL_DEBUG_BREAK() asm("int3")
#else
void EASTL_DEBUG_BREAK(); // User must define this externally.
#endif
#else
void EASTL_DEBUG_BREAK(); // User must define this externally.
#endif
#else
void EASTL_DEBUG_BREAK(); // User must define this externally.
#ifndef EASTL_DEBUG_BREAK
#if EASTL_DEBUG_BREAK_OVERRIDE == 1
// define an empty callable to satisfy the call site.
#define EASTL_DEBUG_BREAK ([]{})
#else
#define EASTL_DEBUG_BREAK EASTL_DEBUG_BREAK_OVERRIDE
#endif
#else
#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
#endif
#endif


Expand Down Expand Up @@ -1451,7 +1468,7 @@ namespace eastl
///////////////////////////////////////////////////////////////////////////////
// EA_COMPILER_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS undef
//
// We need revise this macro to be unefined in some cases, in case the user
// We need revise this macro to be undefined in some cases, in case the user
// isn't using an updated EABase.
///////////////////////////////////////////////////////////////////////////////
#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.
Expand Down Expand Up @@ -1763,11 +1780,18 @@ typedef EASTL_SSIZE_T eastl_ssize_t; // Signed version of eastl_size_t. Concept
/// EASTL_OPENSOURCE
/// This is enabled when EASTL is building built in an "open source" mode. Which is a mode that eliminates code
/// dependencies on other technologies that have not been released publically.
/// EASTL_OPENSOURCE = 0, is the default.
/// EASTL_OPENSOURCE = 0, is the default.
/// EASTL_OPENSOURCE = 1, utilizes technologies that not publically available.
///
#ifndef EASTL_OPENSOURCE
#define EASTL_OPENSOURCE 0
#endif

#endif // Header include guard







12 changes: 7 additions & 5 deletions include/EASTL/internal/red_black_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,13 @@ namespace eastl
//
// Potentially we could provide a constructor that would satisfy the compiler and change the code to use this constructor
// instead of constructing mValue in place within an unconstructed rbtree_node.
#if !defined(EA_COMPILER_NO_DELETED_FUNCTIONS)
rbtree_node(const rbtree_node&) = delete;
#else
private:
rbtree_node(const rbtree_node&);
#if defined(_MSC_VER)
#if !defined(EA_COMPILER_NO_DELETED_FUNCTIONS)
rbtree_node(const rbtree_node&) = delete;
#else
private:
rbtree_node(const rbtree_node&);
#endif
#endif
};

Expand Down
11 changes: 10 additions & 1 deletion include/EASTL/internal/type_transformations.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,16 @@ namespace eastl
template <typename T>
struct add_const
{ typedef typename eastl::add_const_helper<T>::type type; };


// add_const_t is the C++17 using typedef for typename add_const<T>::type.
// We provide a backwards-compatible means to access it through a macro for pre-C++11 compilers.
#if defined(EA_COMPILER_NO_TEMPLATE_ALIASES)
#define EASTL_ADD_CONST_T(T) typename add_const<T>::type
#else
template <typename T>
using add_const_t = typename add_const<T>::type;
#define EASTL_ADD_CONST_T(T) add_const_t<T>
#endif


///////////////////////////////////////////////////////////////////////
Expand Down
27 changes: 25 additions & 2 deletions include/EASTL/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ namespace eastl
map(const Compare& compare, const allocator_type& allocator = EASTL_MAP_DEFAULT_ALLOCATOR);
map(const this_type& x);
#if EASTL_MOVE_SEMANTICS_ENABLED
map(this_type&& x);
map(this_type&& x, const allocator_type& allocator);
map(this_type&& x);
map(this_type&& x, const allocator_type& allocator);
#endif
map(std::initializer_list<value_type> ilist, const Compare& compare = Compare(), const allocator_type& allocator = EASTL_MAP_DEFAULT_ALLOCATOR);

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

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

}; // map

Expand Down Expand Up @@ -416,6 +419,26 @@ namespace eastl
}


#if EASTL_MOVE_SEMANTICS_ENABLED
template <typename Key, typename T, typename Compare, typename Allocator>
inline T& map<Key, T, Compare, Allocator>::operator[](Key&& key)
{
iterator itLower(lower_bound(key)); // itLower->first is >= key.

if((itLower == end()) || mCompare(key, (*itLower).first))
{
itLower = base_type::DoInsertKey(true_type(), itLower, eastl::move(key));
}

return (*itLower).second;

// Reference implementation of this function, which may not be as fast:
//iterator it(base_type::insert(eastl::pair<iterator, iterator>(key, T())).first);
//return it->second;
}
#endif





Expand Down
56 changes: 56 additions & 0 deletions include/EASTL/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -4017,6 +4017,62 @@ namespace eastl
};
#endif


/// to_string
///
/// Converts integral types to an eastl::string with the same content that sprintf produces. The following
/// implementation provides a type safe conversion mechanism which avoids the common bugs associated with sprintf
/// style format strings.
///
/// http://en.cppreference.com/w/cpp/string/basic_string/to_string
///
inline string to_string(int value)
{ return string(string::CtorSprintf(), "%d", value); }
inline string to_string(long value)
{ return string(string::CtorSprintf(), "%ld", value); }
inline string to_string(long long value)
{ return string(string::CtorSprintf(), "%lld", value); }
inline string to_string(unsigned value)
{ return string(string::CtorSprintf(), "%u", value); }
inline string to_string(unsigned long value)
{ return string(string::CtorSprintf(), "%lu", value); }
inline string to_string(unsigned long long value)
{ return string(string::CtorSprintf(), "%llu", value); }
inline string to_string(float value)
{ return string(string::CtorSprintf(), "%f", value); }
inline string to_string(double value)
{ return string(string::CtorSprintf(), "%f", value); }
inline string to_string(long double value)
{ return string(string::CtorSprintf(), "%Lf", value); }


/// to_wstring
///
/// Converts integral types to an eastl::wstring with the same content that sprintf produces. The following
/// implementation provides a type safe conversion mechanism which avoids the common bugs associated with sprintf
/// style format strings.
///
/// http://en.cppreference.com/w/cpp/string/basic_string/to_wstring
///
inline wstring to_wstring(int value)
{ return wstring(wstring::CtorSprintf(), L"%d", value); }
inline wstring to_wstring(long value)
{ return wstring(wstring::CtorSprintf(), L"%ld", value); }
inline wstring to_wstring(long long value)
{ return wstring(wstring::CtorSprintf(), L"%lld", value); }
inline wstring to_wstring(unsigned value)
{ return wstring(wstring::CtorSprintf(), L"%u", value); }
inline wstring to_wstring(unsigned long value)
{ return wstring(wstring::CtorSprintf(), L"%lu", value); }
inline wstring to_wstring(unsigned long long value)
{ return wstring(wstring::CtorSprintf(), L"%llu", value); }
inline wstring to_wstring(float value)
{ return wstring(wstring::CtorSprintf(), L"%f", value); }
inline wstring to_wstring(double value)
{ return wstring(wstring::CtorSprintf(), L"%f", value); }
inline wstring to_wstring(long double value)
{ return wstring(wstring::CtorSprintf(), L"%Lf", value); }

} // namespace eastl


Expand Down
2 changes: 1 addition & 1 deletion include/EASTL/type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ namespace eastl
// in template metaprogramming.
//
// Example usage:
// typedef ChosenType = type_select<is_integral<SomeType>::value, ChoiceAType, ChoiceBType>::type;
// typedef ChosenType = typename type_select<is_integral<SomeType>::value, ChoiceAType, ChoiceBType>::type;
//
template <bool bCondition, class ConditionIsTrueType, class ConditionIsFalseType>
struct type_select { typedef ConditionIsTrueType type; };
Expand Down
47 changes: 46 additions & 1 deletion include/EASTL/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,53 @@ namespace eastl
eastl::swap_ranges(a, a + N, b);
}

/// exchange
///
/// Replaces the value of the first argument with the new value provided.
/// The return value is the previous value of first argument.
///
/// http://en.cppreference.com/w/cpp/utility/exchange
///
#if defined(EA_COMPILER_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS)
template <typename T, typename U>
inline T exchange(T& obj, U&& new_value, typename eastl::enable_if<eastl::is_convertible<U, T>::value>::type* = 0)
{
T old_value = eastl::move(obj);
obj = eastl::forward<U>(new_value);
return old_value;
}
#else
template <typename T, typename U = T>
inline T exchange(T& obj, U&& new_value)
{
T old_value = eastl::move(obj);
obj = eastl::forward<U>(new_value);
return old_value;
}
#endif

///////////////////////////////////////////////////////////////////////
/// as_const
///
/// Converts a 'T&' into a 'const T&' which simplifies calling const functions on non-const objects.
///
/// http://en.cppreference.com/w/cpp/utility/as_const
///
/// C++ proposal paper:
/// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4380.html
///
template <class T>
EA_CONSTEXPR typename eastl::add_const<T>::type& as_const(T& t) EA_NOEXCEPT
{ return t; }

// The C++17 forbids 'eastl::as_const' from accepting rvalues. Passing an rvalue reference to 'eastl::as_const'
// generates an 'const T&' or const lvalue reference to a temporary object.
#if !defined(EA_COMPILER_NO_DELETED_FUNCTIONS)
template <class T>
void as_const(const T&&) = delete;
#endif


///////////////////////////////////////////////////////////////////////
/// rel_ops
///
/// rel_ops allow the automatic generation of operators !=, >, <=, >= from
Expand Down
Loading

0 comments on commit 35f09aa

Please sign in to comment.