24 #ifndef PPL_DB_Row_templates_hh
25 #define PPL_DB_Row_templates_hh 1
36 #if PPL_CXX_SUPPORTS_ZERO_LENGTH_ARRAYS
42 #else // PPL_CXX_SUPPORTS_ZERO_LENGTH_ARRAYS
52 #endif // PPL_CXX_SUPPORTS_ZERO_LENGTH_ARRAYS
59 PPL_ASSERT(size() <= new_size && new_size <= max_size());
60 #if !PPL_CXX_SUPPORTS_ZERO_LENGTH_ARRAYS
61 if (size() == 0 && new_size > 0) {
78 PPL_ASSERT(new_size <= old_size);
81 #if !PPL_CXX_SUPPORTS_ZERO_LENGTH_ARRAYS
98 #if PPL_CXX_SUPPORTS_ZERO_LENGTH_ARRAYS
101 new(&vec_[i]) T(y.
vec_[i]);
104 #else // PPL_CXX_SUPPORTS_ZERO_LENGTH_ARRAYS
110 new(&vec_[i]) T(y.
vec_[i]);
114 #endif // PPL_CXX_SUPPORTS_ZERO_LENGTH_ARRAYS
117 template <
typename T>
127 template <
typename T>
141 bool is_broken =
false;
143 #if PPL_DB_ROW_EXTRA_DEBUG
144 # if !PPL_CXX_SUPPORTS_ZERO_LENGTH_ARRAYS
145 if (x.capacity_ == 0) {
146 cerr <<
"Illegal row capacity: is 0, should be at least 1"
150 else if (x.capacity_ == 1 && row_capacity == 0)
154 # endif // !PPL_CXX_SUPPORTS_ZERO_LENGTH_ARRAYS
155 if (x.capacity_ != row_capacity) {
156 cerr <<
"DB_Row capacity mismatch: is " << x.capacity_
157 <<
", should be " << row_capacity <<
"."
161 #endif // PPL_DB_ROW_EXTRA_DEBUG
163 if (x.
size() != row_size) {
165 cerr <<
"DB_Row size mismatch: is " << x.
size()
166 <<
", should be " << row_size <<
"."
172 #if PPL_DB_ROW_EXTRA_DEBUG
173 if (x.capacity_ < x.
size()) {
175 cerr <<
"DB_Row is completely broken: capacity is " << x.capacity_
176 <<
", size is " << x.
size() <<
"."
181 #endif // PPL_DB_ROW_EXTRA_DEBUG
184 const T& element = x[i];
193 cerr <<
"Not-a-number found in DB_Row."
205 template <
typename T>
221 #endif // !defined(PPL_DB_Row_templates_hh)
Enable_If< Is_Native_Or_Checked< To >::value &&Is_Special< From >::value, Result >::type assign_r(To &to, const From &, Rounding_Dir dir)
T vec_[ 1]
The vector of coefficients.
size_t dimension_type
An unsigned integral type for representing space dimensions.
void bump_size()
Increments the size of *this by 1.
void copy_construct_coefficients(const Impl &y)
Exception-safe copy construction mechanism for coefficients.
bool operator==(const DB_Row< T > &x, const DB_Row< T > &y)
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
The base class for the single rows of matrices.
Enable_If< Is_Native< T >::value, memory_size_type >::type external_memory_in_bytes(const T &)
For native types, returns the size in bytes of the memory managed by the type of the (unused) paramet...
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type is_not_a_number(const T &x)
The real implementation of a DB_Row object.
bool OK(dimension_type row_size, dimension_type row_capacity) const
Checks if all the invariants are satisfied.
void construct_upward_approximation(const U &y)
Exception-safe upward approximation construction mechanism for coefficients.
Plus_Infinity PLUS_INFINITY
The entire library is confined to this namespace.
dimension_type size() const
Gives the number of coefficients currently in use.
void shrink(dimension_type new_size)
Shrinks the row by erasing elements at the end.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
dimension_type size() const
Returns the actual size of this.
Enable_If< Is_Native_Or_Checked< To >::value &&Is_Special< From >::value, Result >::type construct(To &to, const From &, Rounding_Dir dir)
void expand_within_capacity(dimension_type new_size)
Expands the row to size new_size.
#define PPL_DB_ROW_EXTRA_DEBUG