[uClibc-cvs] CVS uClibc++/include
CVS User gkajmowi
gkajmowi at codepoet.org
Sun Jan 9 06:10:47 UTC 2005
Update of /var/cvs/uClibc++/include
In directory nail:/tmp/cvs-serv3855/include
Modified Files:
deque map memory string vector
Log Message:
Change allocator functionality so that it works according to spec.
Conversion of STL to use allocator::construct/destroy
Make test suite nicer.
Change map operator[] code to map suggested spec code.
--- /var/cvs/uClibc++/include/deque 2005/01/08 21:49:37 1.10
+++ /var/cvs/uClibc++/include/deque 2005/01/09 06:10:45 1.11
@@ -118,6 +118,7 @@
}
T * data;
+// T defaultValue;
size_type data_size; //Physical size of array
size_type elements; //Elements in array
size_type first_element; //Element number of array 0..n
@@ -239,7 +240,9 @@
template<class T, class Allocator> deque<T, Allocator>::deque(const Allocator& al)
- : data(0), data_size(0), elements(0), first_element(0), last_element(0), a(al)
+ : data(0),
+// defaultValue(T()),
+ data_size(0), elements(0), first_element(0), last_element(0), a(al)
{
data_size = __UCLIBCXX_STL_BUFFER_SIZE__;
data = a.allocate(data_size);
@@ -250,7 +253,9 @@
template<class T, class Allocator> deque<T, Allocator>::deque(
size_type n, const T& value, const Allocator& al)
- : data(0), elements(n), first_element(0), last_element(0), a(al)
+ : data(0),
+// defaultValue(value),
+ elements(n), first_element(0), last_element(0), a(al)
{
data_size = elements + __UCLIBCXX_STL_BUFFER_SIZE__;
data = a.allocate(data_size);
@@ -258,14 +263,16 @@
last_element = first_element;
for(n=first_element ; n < last_element; ++n ){
- data[n] = value;
+ a.construct(data+n, value);
}
}
template<class T, class Allocator> template <class InputIterator>
deque<T, Allocator>::deque(InputIterator first, InputIterator last, const Allocator& al)
- : data(0), data_size(0), elements(0), first_element(0), last_element(0), a(al)
+ : data(0),
+// defaultValue(T()),
+ data_size(0), elements(0), first_element(0), last_element(0), a(al)
{
data_size = __UCLIBCXX_STL_BUFFER_SIZE__;
data = a.allocate(data_size);
@@ -279,7 +286,9 @@
template<class T, class Allocator> deque<T, Allocator>::deque(const deque<T,Allocator>& x)
- : data(0), elements(0), first_element(0), last_element(0), a(x.a)
+ : data(0),
+// defaultValue(x.defaultValue),
+ elements(0), first_element(0), last_element(0), a(x.a)
{
data_size = x.elements + __UCLIBCXX_STL_BUFFER_SIZE__;
data = a.allocate(data_size);
@@ -292,6 +301,7 @@
template<class T, class Allocator> deque<T, Allocator>::~deque(){
+ clear();
a.deallocate(data, data_size);
data = 0;
data_size = 0;
@@ -305,13 +315,11 @@
if(&x == this){
return *this;
}
- reserve(x.elements);
- first_element = (data_size - x.elements) /2;
- clear();
- for(size_type i = 0; i < x.elements; ++i){
- push_back(x[i]);
+// resize(x.elements, defaultValue);
+ resize(x.elements);
+ for(size_t i = 0; i < elements; ++i){
+ data[array_element(i)] = x[i];
}
- last_element = array_element(elements);
return *this;
}
@@ -322,6 +330,7 @@
clear();
while(first !=last){
push_back(*first);
+ ++first;
}
}
@@ -408,10 +417,12 @@
template<class T, class Allocator> void deque<T, Allocator>::resize(size_type sz, T c){
reserve(sz);
- clear();
- for(size_type i=0; i < sz; ++i){
+ while(sz > size()){
push_back(c);
}
+ while(sz < size()){
+ pop_back();
+ }
}
template<class T, class Allocator> bool deque<T, Allocator>::empty() const{
@@ -475,14 +486,13 @@
template<class T, class Allocator> void deque<T, Allocator>::push_front(const T& x){
reserve(elements + 1);
first_element = first_subtract(1);
- data[first_element] = x;
+ a.construct(data + first_element, x);
++elements;
}
template<class T, class Allocator> void deque<T, Allocator>::push_back(const T& x){
reserve(elements + 1);
-// last_element = array_element(elements);
- data[last_element] = x;
+ a.construct(data + last_element, x);
++elements;
last_element = array_element(elements);
}
@@ -530,12 +540,14 @@
if(elements == 0){
__throw_out_of_range("deque pop_front");
}
+ a.destroy(data + first_element);
first_element = array_element(1);
--elements;
}
template<class T, class Allocator> void deque<T, Allocator>::pop_back(){
last_element = array_element(elements - 1);
+ a.destroy(data + last_element);
--elements;
}
@@ -582,17 +594,17 @@
template<class T, class Allocator> void deque<T, Allocator>::swap(deque<T,Allocator>&)
{
-
+ abort();
}
template<class T, class Allocator> void deque<T, Allocator>::clear()
{
- elements = 0;
- last_element = first_element;
+ while(elements > 0 ){
+ pop_back();
+ }
}
-
template<class T, class Allocator> void deque<T, Allocator>::reserve(typename deque<T, Allocator>::size_type n)
{
if(data_size >= n){
@@ -607,7 +619,8 @@
first_temp = (size_temp - elements) / 2;
for(size_type i = 0; i < elements; ++i){
- data_temp[first_temp + i] = data[array_element(i)];
+ a.construct(data_temp + first_temp + i, data[array_element(i)]);
+ a.destroy(data + array_element(i));
}
//Now shuffle pointers
@@ -616,13 +629,9 @@
data_size = size_temp;
first_element = first_temp;
last_element = first_element + elements;
-
}
-
-
-
template <class T, class Allocator> bool operator==(const deque<T,Allocator>& x, const deque<T,Allocator>& y){
if(x.elements != y.elements){
return false;
@@ -647,6 +656,7 @@
template <class T, class Allocator> bool operator<=(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
template <class T, class Allocator> void swap(deque<T,Allocator>& x, deque<T,Allocator>& y){
T * temp_data;
+// T temp_value;
typename deque<T,Allocator>::size_type temp_size;
//Swap data pointers
@@ -654,6 +664,11 @@
x.data = y.data;
y.data = temp_data;
+ //Swap temp values;
+// temp_value = x.defaultValue;
+// x.defaultValue = y.defaultValue;
+// y.defaultValue = temp_value;
+
//Swap array sizes
temp_size = x.data_size;
x.data_size = y.data_size;
--- /var/cvs/uClibc++/include/map 2005/01/08 21:49:37 1.9
+++ /var/cvs/uClibc++/include/map 2005/01/09 06:10:45 1.10
@@ -613,7 +613,7 @@
typename map<Key, T, Compare, Allocator>::reference
map<Key, T, Compare, Allocator>::operator[](const key_type & k)
{
- iterator i = ifind(k);
+/* iterator i = ifind(k);
if( !c( i->first, k) && !c(k, i->first) ){
return i->second;
}
@@ -621,6 +621,9 @@
t.first = k;
t.second = T();
return insert(t).first->second;
+*/
+ //This is from the spec and is quite ugly.
+ return (*((insert(make_pair(k, T()))).first)).second;
}
template <class Key, class T, class Compare, class Allocator>
--- /var/cvs/uClibc++/include/memory 2004/09/17 02:47:51 1.5
+++ /var/cvs/uClibc++/include/memory 2005/01/09 06:10:45 1.6
@@ -62,15 +62,15 @@
//Space for n Ts
// pointer allocate(size_type n, typename allocator<void>::const_pointer hint=0){
pointer allocate(size_type n, typename allocator<void>::const_pointer = 0){
- return new T[n];
+ return (T*)(::operator new( n * sizeof(T) ));
}
void deallocate(pointer p, size_type){
- delete [] p;
+ ::operator delete(p);
}
//Use placement new to engage the constructor
- void construct(pointer p, const T& val) { new(p)T(val); }
- void destroy(pointer p){p->~T(); } //Call destructor
+ void construct(pointer p, const T& val) { new((void*)p) T(val); }
+ void destroy(pointer p){ ((T*)p)->~T(); } //Call destructor
size_type max_size() const throw();
template<class U> struct rebind { typedef allocator<U> other; };
--- /var/cvs/uClibc++/include/string 2005/01/08 18:01:48 1.14
+++ /var/cvs/uClibc++/include/string 2005/01/09 06:10:45 1.15
@@ -76,9 +76,8 @@
if( rlen > n){
rlen = n;
}
- reserve(rlen);
-
- vector<Ch, A>::elements = rlen;
+ resize(rlen);
+// vector<Ch, A>::elements = rlen;
Tr::copy(vector<Ch, A>::data, str.vector<Ch, A>::data + pos, vector<Ch, A>::elements);
}
@@ -89,8 +88,8 @@
__throw_out_of_range();
}
if(s > 0){
- reserve(n);
- vector<Ch, A>::elements = n;
+ resize(n);
+// vector<Ch, A>::elements = n;
Tr::copy(vector<Ch, A>::data, s, vector<Ch, A>::elements);
}
}
@@ -107,6 +106,7 @@
{
}
+
~basic_string() { }
basic_string& operator=(const basic_string& str){
@@ -114,9 +114,9 @@
return *this;
}
vector<Ch, A>::clear();
- reserve(str.elements);
+ resize(str.elements);
Tr::copy( vector<Ch, A>::data, str.vector<Ch, A>::data, str.elements);
- vector<Ch, A>::elements = str.elements;
+// vector<Ch, A>::elements = str.elements;
return *this;
}
@@ -124,9 +124,9 @@
vector<Ch, A>::clear();
if(s!=0){
size_type len = Tr::length(s);
- reserve(len);
+ resize(len);
Tr::copy( vector<Ch, A>::data, s, len);
- vector<Ch, A>::elements = len;
+// vector<Ch, A>::elements = len;
}
return *this;
}
@@ -148,7 +148,7 @@
}
basic_string& operator+=(const Ch * s){
- return append(s);;
+ return append(s);
}
basic_string& operator+=(Ch c){
@@ -157,9 +157,10 @@
}
basic_string& append(const basic_string& str){
- reserve(vector<Ch, A>::elements + str.elements);
- Tr::copy( vector<Ch, A>::data + vector<Ch, A>::elements, str.vector<Ch, A>::data, str.elements);
- vector<Ch, A>::elements += str.elements;
+ size_t temp = vector<Ch, A>::elements;
+ resize(vector<Ch, A>::elements + str.elements);
+ Tr::copy( vector<Ch, A>::data + temp, str.vector<Ch, A>::data, str.elements);
+// vector<Ch, A>::elements += str.elements;
return *this;
}
@@ -176,33 +177,37 @@
if(vector<Ch, A>::elements > npos - rlen){
__throw_length_error();
}
- reserve(vector<Ch, A>::elements + rlen);
- vector<Ch, A>::elements += rlen;
- Tr::copy( vector<Ch, A>::data + vector<Ch, A>::elements, str.vector<Ch, A>::data, rlen);
+ size_t temp = vector<Ch, A>::elements;
+ resize(vector<Ch, A>::elements + rlen);
+// vector<Ch, A>::elements += rlen;
+ Tr::copy( vector<Ch, A>::data + temp, str.vector<Ch, A>::data, rlen);
return *this;
}
basic_string& append(const Ch* s, size_type n){
- reserve(vector<Ch, A>::elements + n);
- Tr::copy( vector<Ch, A>::data + vector<Ch, A>::elements, s, n);
- vector<Ch, A>::elements+=n;
+ size_t temp = vector<Ch, A>::elements;
+ resize(vector<Ch, A>::elements + n);
+ Tr::copy( vector<Ch, A>::data + temp, s, n);
+// vector<Ch, A>::elements+=n;
return *this;
}
basic_string& append(const Ch* s){
size_type strLen = Tr::length(s);
- reserve(vector<Ch, A>::elements + strLen);
- Tr::copy( vector<Ch, A>::data + vector<Ch, A>::elements, s, strLen);
- vector<Ch, A>::elements+=strLen;
+ size_t temp = vector<Ch, A>::elements;
+ resize(vector<Ch, A>::elements + strLen);
+ Tr::copy( vector<Ch, A>::data + temp, s, strLen);
+// vector<Ch, A>::elements+=strLen;
return *this;
}
basic_string& append(size_type n, Ch c){
- vector<Ch, A>::resize(vector<Ch, A>::elements+ n, c);
+ vector<Ch, A>::resize(vector<Ch, A>::elements + n, c);
return *this;
}
basic_string& assign(const basic_string& str){
- *this = str;
+ operator=(str);
+// *this = str;
return *this;
}
@@ -214,23 +219,19 @@
if(r > n){
r = n;
}
- if(vector<Ch, A>::data_size < r){
- //Not using reserve() because we don't need to keep the old data
- vector<Ch, A>::a.deallocate(vector<Ch, A>::data, vector<Ch, A>::data_size);
- vector<Ch, A>::data_size = r + __UCLIBCXX_STL_BUFFER_SIZE__;
- vector<Ch, A>::data = vector<Ch, A>::a.allocate(vector<Ch, A>::data_size);
- }
+ resize(r);
Tr::copy(vector<Ch, A>::data, str.vector<Ch, A>::data + pos, r);
- vector<Ch, A>::elements = r;
+// vector<Ch, A>::elements = r;
return *this;
}
basic_string& assign(const Ch* s, size_type n){
- if( n > vector<Ch, A>::data_size ){
- vector<Ch, A>::a.deallocate(vector<Ch, A>::data, vector<Ch, A>::data_size);
- vector<Ch, A>::data = vector<Ch, A>::a.allocate(vector<Ch, A>::data_size);
- }
- vector<Ch, A>::elements = n;
+// if( n > vector<Ch, A>::data_size ){
+// vector<Ch, A>::a.deallocate(vector<Ch, A>::data, vector<Ch, A>::data_size);
+// vector<Ch, A>::data = vector<Ch, A>::a.allocate(vector<Ch, A>::data_size);
+// }
+ resize(n);
+// vector<Ch, A>::elements = n;
Tr::copy(vector<Ch, A>::data, s, n);
return *this;
}
@@ -241,13 +242,14 @@
}
basic_string& assign(size_type n, Ch c){
- if(n > vector<Ch, A>::data_size){
- vector<Ch, A>::a.deallocate(vector<Ch, A>::data, vector<Ch, A>::data_size);
- vector<Ch, A>::data_size = n + __UCLIBCXX_STL_BUFFER_SIZE__;
- vector<Ch, A>::data = vector<Ch, A>::a.allocate(vector<Ch, A>::data_size);
- }
- Tr::assign( vector<Ch, A>::data, n ,c);
- vector<Ch, A>::elements = n;
+// if(n > vector<Ch, A>::data_size){
+// vector<Ch, A>::a.deallocate(vector<Ch, A>::data, vector<Ch, A>::data_size);
+// vector<Ch, A>::data_size = n + __UCLIBCXX_STL_BUFFER_SIZE__;
+// vector<Ch, A>::data = vector<Ch, A>::a.allocate(vector<Ch, A>::data_size);
+// }
+// Tr::assign( vector<Ch, A>::data, n ,c);
+// vector<Ch, A>::elements = n;
+ resize(n, c);
return *this;
}
@@ -260,11 +262,12 @@
if(vector<Ch, A>::elements > npos - str.elements){
__throw_length_error();
}
- reserve(str.elements + vector<Ch, A>::elements);
+ size_t temp = vector<Ch, A>::elements
+ resize(str.elements + temp);
Tr::move(vector<Ch, A>::data + pos1 + str.elements, vector<Ch, A>::data + pos1, str.elements);
Tr::copy(vector<Ch, A>::data + pos1, str.vector<Ch, A>::data, str.elements);
- vector<Ch, A>::elements += str.elements;
+// vector<Ch, A>::elements += str.elements;
return *this;
}
*/
@@ -279,10 +282,10 @@
if(vector<Ch, A>::elements > npos - r){
__throw_length_error();
}
- reserve(vector<Ch, A>::elements + r);
+ resize(vector<Ch, A>::elements + r);
Tr::move(vector<Ch, A>::data + pos1 + r, vector<Ch, A>::data + pos1, r);
Tr::copy(vector<Ch, A>::data + pos1, str.vector<Ch, A>::data + pos2, r);
- vector<Ch, A>::elements+=r;
+// vector<Ch, A>::elements+=r;
return *this;
}
@@ -293,10 +296,10 @@
if(vector<Ch, A>::elements > pos - n){
__throw_length_error();
}
- reserve(vector<Ch, A>::elements + n);
+ resize(vector<Ch, A>::elements + n);
Tr::move(vector<Ch, A>::data + pos + n, vector<Ch, A>::data + pos, n);
Tr::copy(vector<Ch, A>::data + pos, s, n);
- vector<Ch, A>::elements+=n;
+// vector<Ch, A>::elements+=n;
return *this;
}
@@ -312,10 +315,10 @@
if(vector<Ch, A>::elements > pos - n){
__throw_length_error();
}
- reserve(vector<Ch, A>::elements + n);
+ resize(vector<Ch, A>::elements + n);
Tr::move(vector<Ch, A>::data + pos + n, vector<Ch, A>::data + pos, n);
Tr::assign(vector<Ch, A>::data + pos, n, c);
- vector<Ch, A>::elements+=n;
+// vector<Ch, A>::elements+=n;
return *this;
}
@@ -350,7 +353,8 @@
*(position-1) = *position;
++position;
}
- --vector<Ch, A>::elements;
+// --vector<Ch, A>::elements;
+ pop_back();
return temp;
}
@@ -364,7 +368,7 @@
++last;
}
- vector<Ch, A>::elements-= count;
+ resize( vector<Ch, A>::elements-count);
return temp;
}
@@ -386,15 +390,21 @@
if((vector<Ch, A>::elements - xlen) >= (npos - rlen)){
__throw_length_error();
}
- reserve(vector<Ch, A>::elements - xlen + rlen);
+
+ size_t temp = vector<Ch, A>::elements;
+ //FIXME - use resize to change size of everything
+ if(rlen > xlen){ //Only if making larger
+ resize(temp - xlen + rlen);
+ }
//Final length = vector<Ch, A>::elements - xlen + rlen
//Initial block is of size pos1
//Block 2 is of size len
- Tr::move(vector<Ch, A>::data + pos1 + rlen, vector<Ch, A>::data + pos1 + xlen, vector<Ch, A>::elements - pos1 - xlen);
+ Tr::move(vector<Ch, A>::data + pos1 + rlen, vector<Ch, A>::data + pos1 + xlen, temp - pos1 - xlen);
Tr::copy(vector<Ch, A>::data + pos1, str.vector<Ch, A>::data + pos2, rlen);
- vector<Ch, A>::elements = vector<Ch, A>::elements - xlen + rlen;
+// vector<Ch, A>::elements = vector<Ch, A>::elements - xlen + rlen;
+ resize(temp - xlen + rlen);
return *this;
}
--- /var/cvs/uClibc++/include/vector 2005/01/08 21:49:37 1.11
+++ /var/cvs/uClibc++/include/vector 2005/01/09 06:10:45 1.12
@@ -66,26 +66,31 @@
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- explicit vector(const Allocator& al= Allocator()): data(0), defaultValue(T()),
+ explicit vector(const Allocator& al= Allocator()): data(0), //defaultValue(T()),
data_size(__UCLIBCXX_STL_BUFFER_SIZE__), elements(0), a(al)
{
data = a.allocate(data_size);
}
explicit vector(size_type n, const T& value = T(), const Allocator& al= Allocator()) :
- data(0), defaultValue(value), data_size(0), elements(0), a(al)
+ data(0),
+// defaultValue(value),
+ data_size(0), elements(0), a(al)
{
elements = n;
data_size = elements + __UCLIBCXX_STL_BUFFER_SIZE__;
data = a.allocate(data_size);
for(size_type i = 0; i < elements; i++){
- data[i] = value;
+// data[i] = value;
+ a.construct( data+i, value);
}
}
template <class InputIterator> vector(InputIterator first, InputIterator last, const Allocator& al = Allocator()):
- data(0), defaultValue(T()), data_size(__UCLIBCXX_STL_BUFFER_SIZE__), elements(0), a(al)
+ data(0),
+// defaultValue(T()),
+ data_size(__UCLIBCXX_STL_BUFFER_SIZE__), elements(0), a(al)
{
data = a.allocate(data_size);
assign(first, last);
@@ -96,15 +101,19 @@
elements = x.elements;
data_size = elements + __UCLIBCXX_STL_BUFFER_SIZE__;
- defaultValue = x.defaultValue;
+// defaultValue = x.defaultValue;
data = a.allocate(data_size);
for(size_type i = 0; i < elements; i++){
- data[i] = x.data[i];
+// data[i] = x.data[i];
+ a.construct(data+i, x.data[i]);
}
}
~vector(){
+ for(size_t i = 0; i < elements; ++i){
+ a.destroy(data + i);
+ }
a.deallocate(data, data_size);
data = 0;
elements = 0;
@@ -116,14 +125,44 @@
return *this;
}
- delete [] data;
- data = 0;
+/* if(data_size < x.elements){
+ for(size_t i = 0; i < elements; ++i){
+ a.destroy(data + i);
+ }
+ a.deallocate(data);
+ data = 0;
+
+ data_size = elements + __UCLIBCXX_STL_BUFFER_SIZE__;
+ data = a.allocate(data_size);
+ elements = x.elements;
+ for(size_t i = 0; i< elements; ++i){
+ a.construct(data+i, x.data[i]);
+ }
+ }else{
+ size_t minElements = elements;
+ if(minElements > x.elements){
+ minElements = x.elements;
+ }
+
+ //Construct extra needed elements (if aplicable)
+ for(size_t i = elements; i < x.elements; +i){
+ a.construct(data+i, x.data[i]);
+ }
+ //Destroy extra elements (if applicable)
+ for(size_t i = minElements; i < elements; ++i){
+ a.destroy(data+i);
+ }
+ //Copy over the rest of the elements
+ for(size_t i = 0; i < minElements; ++i){
+ data[i] = x.data[i];
+ }
+ elements = x.elements;
+ }*/
- elements = x.elements;
- data_size = elements + __UCLIBCXX_STL_BUFFER_SIZE__;
- data = a.allocate(data_size);
+// resize(x.elements, defaultValue);
+ resize(x.elements);
- for(size_type i = 0; i < elements; i++){
+ for(size_t i = 0; i < elements; ++i){
data[i] = x.data[i];
}
@@ -135,8 +174,8 @@
insert(begin(), first, last);
}
-// template <class Size, class U> void assign(Size n, const U& u = U()){
- void assign(size_type n, const T& u ){
+ template <class Size, class U> void assign(Size n, const U& u = U()){
+// void assign(size_type n, const T& u ){
clear();
resize(n, u);
}
@@ -240,11 +279,13 @@
}
inline void pop_back(){
+// resize(size() - 1, defaultValue);
resize(size() - 1);
}
iterator insert(iterator position, const T& x = T()){
size_type index = position - data;
+// resize(size() + 1, defaultValue);
resize(size() + 1);
for(size_type i = elements - 1; i > index; --i){
data[i] = data[i-1];
@@ -255,6 +296,7 @@
void _insert_fill(iterator position, size_type n, const T & x){
size_type index = position - data;
+// resize(size() + n, defaultValue);
resize(size() + n);
for(size_type i = elements -1; (i > (index+n-1)); --i){
@@ -301,6 +343,7 @@
for(size_type i = index; i < (elements - 1); ++i){
data[i] = data[i+1];
}
+// resize(size() - 1, defaultValue);
resize(size() - 1);
return (data + index);
}
@@ -311,6 +354,7 @@
for(size_type i = index; i < (elements - width) ;++i){
data[i] = data[i+width];
}
+// resize(size() - width, defaultValue);
resize(size() - width);
return (data + index);
}
@@ -345,7 +389,7 @@
protected:
T* data;
- T defaultValue;
+// T defaultValue;
size_type data_size;
size_type elements;
Allocator a;
@@ -364,7 +408,8 @@
data = a.allocate(data_size);
for(size_type i = 0; i<elements; ++i){
- data[i] = temp_ptr[i];
+ a.construct(data+i, temp_ptr[i]);
+ a.destroy(temp_ptr+i);
}
a.deallocate(temp_ptr, temp_size);
}
@@ -372,16 +417,16 @@
template<class T, class Allocator> void vector<T, Allocator>::resize(size_type sz, T c){
if(sz > elements){ //Need to actually call constructor
- size_type temp_el = elements;
reserve(sz + __UCLIBCXX_STL_BUFFER_SIZE__);
- elements = sz;
-
- for(size_type i = temp_el; i<elements;i++){
- data[i] = c;
+ for(size_type i = elements; i<sz ; ++i){
+ a.construct(data+i, c);
}
+ elements = sz;
}else{
- reserve(sz + __UCLIBCXX_STL_BUFFER_SIZE__);
+ for(size_t i = sz; i< elements; ++i){
+ a.destroy(data+i);
+ }
elements = sz;
}
}
More information about the uClibc-cvs
mailing list