21 #ifndef SELDON_FILE_VECTOR_INLINE_CXX
24 #include "VectorExpressionInline.cxx"
44 template <
class T,
class Allocator>
57 template <
class T,
class Allocator>
70 template <
class T,
class Allocator>
85 template <
class T,
class Allocator>
93 template <
class T,
class Allocator>
97 #ifdef SELDON_CHECK_MEMORY
104 Allocator::deallocate(data_, m_);
109 #ifdef SELDON_CHECK_MEMORY
130 template <
class T,
class Allocator>
141 template <
class T,
class Allocator>
152 template <
class T,
class Allocator>
164 template <
class T,
class Allocator>
167 return sizeof(*this) +
sizeof(T)*
size_t(GetSize());
175 template <
class T,
class Allocator>
176 inline typename Vector_Base<T, Allocator>::pointer
187 template <
class T,
class Allocator>
188 inline typename Vector_Base<T, Allocator>::const_pointer
192 Allocator
>::const_pointer>(data_);
200 template <
class T,
class Allocator>
203 return reinterpret_cast<void*
>(data_);
211 template <
class T,
class Allocator>
214 return reinterpret_cast<const void*
>(data_);
232 template <
class T,
class Allocator>
243 template <
class T,
class Allocator>
248 #ifdef SELDON_CHECK_MEMORY
253 this->data_ = Allocator::allocate(i,
this);
255 #ifdef SELDON_CHECK_MEMORY
262 if (this->data_ == NULL)
264 if (this->data_ == NULL && i != 0)
265 throw NoMemory(
"Vector<VectFull>::Vector(int)",
266 string(
"Unable to allocate memory for a vector of size ")
267 +
to_str(i*
sizeof(T)) +
" bytes ("
268 +
to_str(i) +
" elements).");
285 template <
class T,
class Allocator>
298 template <
class T,
class Allocator>
299 inline Vector<T, VectFull, Allocator>::
304 #ifdef SELDON_CHECK_MEMORY
309 this->data_ = Allocator::allocate(V.
GetM(),
this);
311 #ifdef SELDON_CHECK_MEMORY
318 if (this->data_ == NULL)
320 if (this->data_ == NULL && V.
GetM() != 0)
321 throw NoMemory(
"Vector<VectFull>::Vector(Vector<VectFull>&)",
322 string(
"Unable to allocate memory for a vector of size ")
327 Allocator::memorycpy(this->data_, V.
GetData(), V.
GetM());
338 template <
class T,
class Allocator>
354 template <
class T,
class Allocator>
368 template <
class T,
class Allocator>
382 template <
class T,
class Allocator>
392 #ifdef SELDON_CHECK_MEMORY
398 reinterpret_cast<pointer
>(Allocator::
399 reallocate(this->data_, i,
this));
401 #ifdef SELDON_CHECK_MEMORY
409 if (this->data_ == NULL)
435 template <
class T,
class Allocator>
460 template <
class T,
class Allocator>
461 template <
class Allocator0>
462 inline void Vector<T, VectFull, Allocator>
465 SetData(V.GetLength(), V.GetData());
475 template <
class T,
class Allocator>
493 template <
class T,
class Allocator>
498 #ifdef SELDON_CHECK_BOUNDS
499 CheckBounds(i, this->m_,
"Vector<VectFull>");
502 return this->data_[i];
511 template <
class T,
class Allocator>
516 #ifdef SELDON_CHECK_BOUNDS
517 CheckBounds(i, this->m_,
"Vector<VectFull>");
520 return this->data_[i];
529 template <
class T,
class Allocator>
534 #ifdef SELDON_CHECK_BOUNDS
535 CheckBounds(i, this->m_,
"Vector<VectFull>");
538 return this->data_[i];
547 template <
class T,
class Allocator>
552 #ifdef SELDON_CHECK_BOUNDS
553 CheckBounds(i, this->m_,
"Vector<VectFull>");
556 return this->data_[i];
566 template <
class T,
class Allocator>
582 template <
class T,
class Allocator>
588 Allocator::memorycpy(this->data_, X.
GetData(), this->m_);
598 template <
class T,
class Allocator>
610 template <
class T,
class Allocator>
template<
class T0>
614 for (
size_t i = 0; i < this->m_; i++)
615 this->data_[i] *= alpha;
622 template<
class T,
class Allocator>
template<
class E>
627 for (
size_t i = 0; i < this->m_; i++)
628 this->data_[i] = X(i);
635 template<
class T,
class Allocator>
template<
class E>
639 for (
size_t i = 0; i < this->m_; i++)
640 this->data_[i] += X(i);
647 template<
class T,
class Allocator>
template<
class E>
651 for (
size_t i = 0; i < this->m_; i++)
652 this->data_[i] -= X(i);
664 template <
class T,
class Allocator>
667 size_t i = this->GetLength();
668 this->Reallocate(i + 1);
677 template <
class T,
class Allocator>
template<
class T0>
681 this->data_[this->m_-1] = x;
689 template <
class T,
class Allocator>
template<
class Allocator0>
693 size_t Nold = this->m_;
694 Resize(this->m_ + X.GetSize());
695 for (
size_t i = 0; i < X.GetSize(); i++)
696 this->data_[Nold+i] = X(i);
709 template <
class T,
class Allocator>
726 template <
class T,
class Allocator>
729 Allocator::memoryset(this->data_,
char(0),
730 this->GetDataSize() *
sizeof(value_type));
735 template <
class T,
class Allocator>
738 for (
size_t i = 0; i < this->m_; i++)
747 template <
class T,
class Allocator>
753 for (
size_t i = 0; i < this->m_; i++)
762 template <
class T,
class Allocator>
776 template <
class T,
class Allocator>
779 #ifndef SELDON_WITHOUT_REINIT_RANDOM
782 for (
size_t i = 0; i < this->m_; i++)
788 template <
class T,
class Allocator>
791 for (
size_t i = 0; i < this->GetLength(); i++)
792 cout << (*
this)(i) <<
"\t";
799 #define SELDON_FILE_VECTOR_INLINE_CXX