From bb9068f7e039bf783ebac90816008352ae0bad42 Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 12 Feb 2013 20:41:41 +0000 Subject: [PATCH] *Core: Fixed Vector::InsertSplit git-svn-id: svn://ultimatepp.org/upp/trunk@5800 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/InVector.h | 10 ++++++++++ uppsrc/Core/Vcont.hpp | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/uppsrc/Core/InVector.h b/uppsrc/Core/InVector.h index 0d257f37b..1996a676f 100644 --- a/uppsrc/Core/InVector.h +++ b/uppsrc/Core/InVector.h @@ -1,9 +1,15 @@ +template > +class SortedVectorMap; + + template class InVector : public MoveableAndDeepCopyOption< InVector > { public: class ConstIterator; class Iterator; + template friend class SortedVectorMap; + private: Vector< Vector > data; Vector< Vector > index; @@ -229,6 +235,8 @@ private: ALess(const L& less) : less(less) {} }; + template friend class SortedVectorMap; + public: T& Insert(int i, T *newt) { iv.Insert(i, newt); return *newt; } T& Insert(int i) { return Insert(i, new T); } @@ -380,6 +388,8 @@ template > class SortedIndex : MoveableAndDeepCopyOption< SortedIndex > { InVector iv; Less less; + + template friend class SortedVectorMap; public: int Add(const T& x) { return iv.InsertUpperBound(x, less); } diff --git a/uppsrc/Core/Vcont.hpp b/uppsrc/Core/Vcont.hpp index 1b925ccbd..55dd422d9 100644 --- a/uppsrc/Core/Vcont.hpp +++ b/uppsrc/Core/Vcont.hpp @@ -318,8 +318,8 @@ void Vector::InsertSplit(int i, Vector& v, int from) if(n) { RawInsert(i, n); memcpy(vector + i, v.vector + from, sizeof(T) * n); + v.items = from; } - v.Trim(from); } template