From 2be8c1827db376b24f563e595d077fc080c37e1e Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 20 Nov 2016 07:42:16 +0000 Subject: [PATCH] Core: Fixed to compile with CLANG git-svn-id: svn://ultimatepp.org/upp/trunk@10467 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/InVector.h | 13 +++++++++++-- uppsrc/Core/Index.h | 19 ++++++++++++++----- uppsrc/Core/Topt.h | 24 ------------------------ uppsrc/Core/init | 4 ++++ 4 files changed, 29 insertions(+), 31 deletions(-) create mode 100644 uppsrc/Core/init diff --git a/uppsrc/Core/InVector.h b/uppsrc/Core/InVector.h index 4f39d1fb8..6fa774e79 100644 --- a/uppsrc/Core/InVector.h +++ b/uppsrc/Core/InVector.h @@ -536,12 +536,21 @@ public: friend void Swap(SortedIndex& a, SortedIndex& b){ a.Swap(b); } - STL_SINDEX_COMPATIBILITY(SortedIndex) - #ifdef DEPRECATED ConstIterator GetIter(int pos) const { return iv.GetIter(pos); } typedef T ValueType; + + typedef T value_type; + typedef ConstIterator const_iterator; + typedef const T& const_reference; + typedef int size_type; + typedef int difference_type; + const_iterator Begin() const { return begin(); } + const_iterator End() const { return end(); } + void clear() { Clear(); } + size_type size() { return GetCount(); } + bool empty() const { return IsEmpty(); } #endif }; diff --git a/uppsrc/Core/Index.h b/uppsrc/Core/Index.h index 3d6113999..634799c41 100644 --- a/uppsrc/Core/Index.h +++ b/uppsrc/Core/Index.h @@ -145,7 +145,7 @@ public: void Trim(int n) { key.SetCount(n); hash.Trim(n); } void Drop(int n = 1) { key.Drop(n); hash.Drop(n); } const T& Top() const { return key.Top(); } - T Pop() { T x = B::Top(); B::Drop(); return x; } + T Pop() { T x = Top(); Drop(); return x; } void Reserve(int n) { key.Reserve(n); hash.Reserve(n); } void Shrink() { key.Shrink(); hash.Shrink(); } @@ -183,10 +183,8 @@ public: ConstIterator begin() const { return key.Begin(); } ConstIterator end() const { return key.End(); } - friend void Swap(Index& b) { UPP::Swap(hash, b.hash); - UPP::Swap(key, b.key); } - - STL_INDEX_COMPATIBILITY(Index) + friend void Swap(Index& a, Index& b) { UPP::Swap(a.hash, b.hash); + UPP::Swap(a.key, b.key); } #ifdef DEPRECATED Index& operator<<=(const Vector& s) { *this = clone(s); return *this; } @@ -197,5 +195,16 @@ public: void ClearIndex() { hash.ClearIndex(); } void Reindex(int n) { hash.Reindex(n); } void Reindex() { hash.Reindex(); } + + typedef T value_type; + typedef ConstIterator const_iterator; + typedef const T& const_reference; + typedef int size_type; + typedef int difference_type; + const_iterator Begin() const { return begin(); } + const_iterator End() const { return end(); } + void clear() { Clear(); } + size_type size() { return GetCount(); } + bool empty() const { return IsEmpty(); } #endif }; diff --git a/uppsrc/Core/Topt.h b/uppsrc/Core/Topt.h index d1e90bb82..7a3570ecc 100644 --- a/uppsrc/Core/Topt.h +++ b/uppsrc/Core/Topt.h @@ -252,30 +252,6 @@ public: typedef T pointer; \ typedef T reference; \ -#define STL_INDEX_COMPATIBILITY(C) \ - typedef T value_type; \ - typedef ConstIterator const_iterator; \ - typedef const T& const_reference; \ - typedef int size_type; \ - typedef int difference_type; \ - const_iterator Begin() const { return B::begin(); } \ - const_iterator End() const { return B::end(); } \ - void clear() { B::Clear(); } \ - size_type size() { return B::GetCount(); } \ - bool empty() const { return B::IsEmpty(); } \ - -#define STL_SINDEX_COMPATIBILITY(C) \ - typedef T value_type; \ - typedef ConstIterator const_iterator; \ - typedef const T& const_reference; \ - typedef int size_type; \ - typedef int difference_type; \ - const_iterator Begin() const { return begin(); } \ - const_iterator End() const { return end(); } \ - void clear() { Clear(); } \ - size_type size() { return GetCount(); } \ - bool empty() const { return IsEmpty(); } \ - #define STL_BI_COMPATIBILITY(C) \ typedef T value_type; \ typedef ConstIterator const_iterator; \ diff --git a/uppsrc/Core/init b/uppsrc/Core/init new file mode 100644 index 000000000..7eb91cbdd --- /dev/null +++ b/uppsrc/Core/init @@ -0,0 +1,4 @@ +#ifndef _Core_icpp_init_stub +#define _Core_icpp_init_stub +#include "plugin\z/init" +#endif