Boost.Pool: различия между версиями

Содержимое удалено Содержимое добавлено
Строка 427:
Это следует из следующей цитаты:
 
[5.3.3/2] (Выражения::Унарные выражения::Sizeof) ... Когда применяется к массиву, результатом является общее число байт в массиве. Это неявно подразумеваетозначает, что размер массива равен размеру элемента массива умноженному на число таких элементов.
[5.3.3/2] (Expressions::Unary expressions::Sizeof) ... When applied to an array, the result is the total number of bytes in the array. This implies that the size of an array of n elements is n times the size of an element.
 
[5.3.3/2] (Выражения::Унарные выражения::Sizeof) ... Когда применяется к массиву, результатом является общее число байт в массиве. Это неявно подразумевает, что размер массива равен размеру элемента массива умноженному на число таких элементов.
 
Поэтому, массивы не могут содержать заполнение, но элементы внутри массивов могут.
Строка 437 ⟶ 435 :
Вытекает из:
 
* [3.7.3.1/2] (Basic concepts::Storage duration::Dynamic storage duration::Allocation functions) "... The pointer returned shall be suitably aligned so that it can be converted to a pointer of any complete object type and then used to access the object or array in the storage allocated ..." <br />
* [3.7.3.1/2] (Основные концепции::Продолжительность хранения::Продолжительность динамического хранения::Функции выделения) "... Возвращаемый указатель должен быть подходящим образом выравнен таким образом, чтобы мог быть преобразован в указатель на любой объект завершенного типа и затем использован для доступа к объекту или массиву в выделенном хранилище ..." <br />
* [5.3.4/10] (Expressions::Unary expressions::New) "... For arrays of char and unsigned char, the difference between the result of the new-expression and the address returned by the allocation function shall be an integral multiple of the most stringent alignment requirement (3.9) of any object type whose size is no greater than the size of the array being created. [Note: Because allocation functions are assumed to return pointers to storage that is appropriately aligned for objects of any type, this constraint on array allocation overhead permits the common idiom of allocating character arrays into which objects of other types will later be placed."
* [5.3.4/10] (Выражения::Унарные выражения::New) "... Для массивов изтипов char и unsigned char, разница между результатом new-выражения и адресом, возвращаемом функцией выделения должен быть shall be an integral multiple of the most stringent alignment requirement (3.9) of any object type whose size is no greater than the size of the array being created. [Note: Because allocation functions are assumed to return pointers to storage that is appropriately aligned for objects of any type, this constraint on array allocation overhead permits the common idiom of allocating character arrays into which objects of other types will later be placed."
Consider: imaginary object type Element of a size which is a multiple of some actual object size; assume sizeof(Element) > POD_size