COMMON: Remove USE_CXX11 checks, it is now always present
This commit is contained in:
parent
e5a60d34cc
commit
c544e5119b
8 changed files with 3 additions and 33 deletions
|
@ -27,10 +27,7 @@
|
|||
#include "common/algorithm.h"
|
||||
#include "common/textconsole.h" // For error()
|
||||
#include "common/memory.h"
|
||||
|
||||
#ifdef USE_CXX11
|
||||
#include "common/initializer_list.h"
|
||||
#endif
|
||||
|
||||
namespace Common {
|
||||
|
||||
|
@ -99,7 +96,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef USE_CXX11
|
||||
/**
|
||||
* Construct an array as a copy of the given array using the C++11 move semantic.
|
||||
*/
|
||||
|
@ -124,7 +120,6 @@ public:
|
|||
if (_storage)
|
||||
Common::uninitialized_copy(list.begin(), list.end(), _storage);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Construct an array by copying data from a regular array.
|
||||
|
@ -258,7 +253,6 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
#ifdef USE_CXX11
|
||||
/** Assign the given array to this array using the C++11 move semantic. */
|
||||
Array &operator=(Array<T> &&old) {
|
||||
if (this == &old)
|
||||
|
@ -275,7 +269,6 @@ public:
|
|||
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Return the size of the array. */
|
||||
size_type size() const {
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
#define COMMON_INITIALIZER_LIST_H
|
||||
|
||||
// Some compiler only have partial support for C++11 and we provide replacements for reatures not available.
|
||||
#ifdef USE_CXX11
|
||||
|
||||
#ifdef NO_CXX11_INITIALIZER_LIST
|
||||
namespace std {
|
||||
template<class T> class initializer_list {
|
||||
|
@ -44,6 +42,4 @@ namespace std {
|
|||
|
||||
#endif // NO_CXX11_INITIALIZER_LIST
|
||||
|
||||
#endif // USE_CXX11
|
||||
|
||||
#endif // COMMON_INITIALIZER_LIST_H
|
||||
|
|
|
@ -27,10 +27,9 @@
|
|||
#include "common/noncopyable.h"
|
||||
#include "common/safe-bool.h"
|
||||
#include "common/types.h"
|
||||
#ifdef USE_CXX11
|
||||
|
||||
/* For nullptr_t */
|
||||
#include <cstddef>
|
||||
#endif
|
||||
|
||||
namespace Common {
|
||||
|
||||
|
@ -89,10 +88,8 @@ public:
|
|||
BasePtr() : _refCount(nullptr), _deletion(nullptr), _pointer(nullptr) {
|
||||
}
|
||||
|
||||
#ifdef USE_CXX11
|
||||
explicit BasePtr(std::nullptr_t) : _refCount(nullptr), _deletion(nullptr), _pointer(nullptr) {
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class T2>
|
||||
explicit BasePtr(T2 *p) : _refCount(new RefValue(1)), _deletion(new BasePtrDeletionImpl<T2>(p)), _pointer(p) {
|
||||
|
@ -286,10 +283,8 @@ public:
|
|||
SharedPtr() : BasePtr<T>() {
|
||||
}
|
||||
|
||||
#ifdef USE_CXX11
|
||||
SharedPtr(std::nullptr_t) : BasePtr<T>() {
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class T2>
|
||||
explicit SharedPtr(T2 *p) : BasePtr<T>(p) {
|
||||
|
@ -352,10 +347,8 @@ public:
|
|||
WeakPtr() : BasePtr<T>() {
|
||||
}
|
||||
|
||||
#ifdef USE_CXX11
|
||||
WeakPtr(std::nullptr_t) : BasePtr<T>() {
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class T2>
|
||||
explicit WeakPtr(T2 *p) : BasePtr<T>(p) {
|
||||
|
|
|
@ -482,9 +482,9 @@ typedef uint32 uintptr;
|
|||
#endif
|
||||
|
||||
//
|
||||
// std::nullptr_t when c++11 is enabled but this type is not available
|
||||
// std::nullptr_t when this type is not available
|
||||
//
|
||||
#if defined(USE_CXX11) && defined(NO_CXX11_NULLPTR_T)
|
||||
#if defined(NO_CXX11_NULLPTR_T)
|
||||
namespace std {
|
||||
typedef decltype(nullptr) nullptr_t;
|
||||
}
|
||||
|
|
|
@ -172,11 +172,9 @@ bool String::contains(uint32 x) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef USE_CXX11
|
||||
bool String::contains(char32_t x) const {
|
||||
return contains((uint32)x);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef SCUMMVM_UTIL
|
||||
|
||||
|
|
|
@ -116,9 +116,7 @@ public:
|
|||
bool contains(const char *x) const;
|
||||
bool contains(char x) const;
|
||||
bool contains(uint32 x) const;
|
||||
#ifdef USE_CXX11
|
||||
bool contains(char32_t x) const;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Simple DOS-style pattern matching function (understands * and ? like used in DOS).
|
||||
|
|
|
@ -52,11 +52,7 @@ class String;
|
|||
* The presence of \0 characters in the string will cause undefined
|
||||
* behavior in some operations.
|
||||
*/
|
||||
#ifdef USE_CXX11
|
||||
typedef char32_t u32char_type_t;
|
||||
#else
|
||||
typedef uint32 u32char_type_t;
|
||||
#endif
|
||||
|
||||
class U32String : public BaseString<u32char_type_t> {
|
||||
public:
|
||||
|
@ -71,11 +67,9 @@ public:
|
|||
/** Construct a new string containing exactly @p len characters read from address @p str. */
|
||||
U32String(const value_type *str, uint32 len) : BaseString<u32char_type_t>(str, len) {}
|
||||
|
||||
#ifdef USE_CXX11
|
||||
explicit U32String(const uint32 *str) : BaseString<u32char_type_t>((const value_type *) str) {}
|
||||
U32String(const uint32 *str, uint32 len) : BaseString<u32char_type_t>((const value_type *) str, len) {}
|
||||
U32String(const uint32 *beginP, const uint32 *endP) : BaseString<u32char_type_t>((const value_type *) beginP, (const value_type *) endP) {}
|
||||
#endif
|
||||
|
||||
/** Construct a new string containing the characters between @p beginP (including) and @p endP (excluding). */
|
||||
U32String(const value_type *beginP, const value_type *endP) : BaseString<u32char_type_t>(beginP, endP) {}
|
||||
|
|
|
@ -323,13 +323,11 @@ class ArrayTestSuite : public CxxTest::TestSuite
|
|||
}
|
||||
|
||||
void test_array_constructor_list() {
|
||||
#ifdef USE_CXX11
|
||||
Common::Array<int> array = {1, 42, 255};
|
||||
TS_ASSERT_EQUALS(array.size(), 3U);
|
||||
TS_ASSERT_EQUALS(array[0], 1);
|
||||
TS_ASSERT_EQUALS(array[1], 42);
|
||||
TS_ASSERT_EQUALS(array[2], 255);
|
||||
#endif
|
||||
}
|
||||
|
||||
void test_array_constructor_count_copy_value() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue