Главная » Просмотр файлов » Стандарт C++ 11

Стандарт C++ 11 (1119564), страница 37

Файл №1119564 Стандарт C++ 11 (Стандарт C++ 11) 37 страницаСтандарт C++ 11 (1119564) страница 372019-05-09СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 37)

[ Note: that is, the expression &(qualified-id), where the qualified-id is enclosed inparentheses, does not form an expression of type “pointer to member.” Neither does qualified-id, becausethere is no implicit conversion from a qualified-id for a non-static member function to the type “pointer tomember function” as there is from an lvalue of function type to the type “pointer to function” (4.3). Nor is&unqualified-id a pointer to member, even within the scope of the unqualified-id’s class.

— end note ]5The address of an object of incomplete type can be taken, but if the complete type of that object is a classtype that declares operator&() as a member function, then the behavior is undefined (and no diagnostic isrequired). The operand of & shall not be a bit-field.6The address of an overloaded function (Clause 13) can be taken only in a context that uniquely determineswhich version of the overloaded function is referred to (see 13.4).

[ Note: since the context might determinewhether the operand is a static or non-static member function, the context can also affect whether theexpression has type “pointer to function” or “pointer to member function.” — end note ]7The operand of the unary + operator shall have arithmetic, unscoped enumeration, or pointer type and theresult is the value of the argument. Integral promotion is performed on integral or enumeration operands.The type of the result is the type of the promoted operand.8The operand of the unary - operator shall have arithmetic or unscoped enumeration type and the resultis the negation of its operand. Integral promotion is performed on integral or enumeration operands. Thenegative of an unsigned quantity is computed by subtracting its value from 2n , where n is the number ofbits in the promoted operand.

The type of the result is the type of the promoted operand.9The operand of the logical negation operator ! is contextually converted to bool (Clause 4); its value istrue if the converted operand is false and false otherwise. The type of the result is bool.10The operand of ˜ shall have integral or unscoped enumeration type; the result is the one’s complement ofits operand. Integral promotions are performed. The type of the result is the type of the promoted operand.There is an ambiguity in the unary-expression ˜X(), where X is a class-name or decltype-specifier. Theambiguity is resolved in favor of treating ˜ as a unary complement rather than treating ˜X as referring to adestructor.5.3.2Increment and decrement[expr.pre.incr]1The operand of prefix ++ is modified by adding 1, or set to true if it is bool (this use is deprecated).

Theoperand shall be a modifiable lvalue. The type of the operand shall be an arithmetic type or a pointer toa completely-defined object type. The result is the updated operand; it is an lvalue, and it is a bit-field ifthe operand is a bit-field. If x is not of type bool, the expression ++x is equivalent to x+=1 [ Note: See thediscussions of addition (5.7) and assignment operators (5.17) for information on conversions. — end note ]2The operand of prefix -- is modified by subtracting 1. The operand shall not be of type bool.

Therequirements on the operand of prefix -- and the properties of its result are otherwise the same as those of§ 5.3.2110© ISO/IEC 2011 – All rights reservedISO/IEC 14882:2011(E)prefix ++. [ Note: For postfix increment and decrement, see 5.2.6. — end note ]5.3.3Sizeof[expr.sizeof ]1The sizeof operator yields the number of bytes in the object representation of its operand. The operand iseither an expression, which is an unevaluated operand (Clause 5), or a parenthesized type-id.

The sizeofoperator shall not be applied to an expression that has function or incomplete type, to an enumerationtype whose underlying type is not fixed before all its enumerators have been declared, to the parenthesizedname of such types, or to an lvalue that designates a bit-field.

sizeof(char), sizeof(signed char) andsizeof(unsigned char) are 1. The result of sizeof applied to any other fundamental type (3.9.1) isimplementation-defined. [ Note: in particular, sizeof(bool), sizeof(char16_t), sizeof(char32_t), andsizeof(wchar_t) are implementation-defined.74 — end note ] [ Note: See 1.7 for the definition of byteand 3.9 for the definition of object representation.

— end note ]2When applied to a reference or a reference type, the result is the size of the referenced type. When appliedto a class, the result is the number of bytes in an object of that class including any padding required forplacing objects of that type in an array. The size of a most derived class shall be greater than zero (1.8).The result of applying sizeof to a base class subobject is the size of the base class type.75 When appliedto an array, the result is the total number of bytes in the array. This implies that the size of an array of nelements is n times the size of an element.3The sizeof operator can be applied to a pointer to a function, but shall not be applied directly to a function.4The lvalue-to-rvalue (4.1), array-to-pointer (4.2), and function-to-pointer (4.3) standard conversions are notapplied to the operand of sizeof.5The identifier in a sizeof...

expression shall name a parameter pack. The sizeof... operator yieldsthe number of arguments provided for the parameter pack identifier. A sizeof... expression is a packexpansion (14.5.3). [ Example:template<class... Types>struct count {static const std::size_t value = sizeof...(Types);};— end example ]6The result of sizeof and sizeof... is a constant of type std::size_t. [ Note: std::size_t is defined inthe standard header <cstddef> (18.2). — end note ]5.3.41New[expr.new]The new-expression attempts to create an object of the type-id (8.1) or new-type-id to which it is applied.The type of that object is the allocated type. This type shall be a complete object type, but not anabstract class type or array thereof (1.8, 3.9, 10.4). It is implementation-defined whether over-aligned typesare supported (3.11).

[ Note: because references are not objects, references cannot be created by newexpressions. — end note ] [ Note: the type-id may be a cv-qualified type, in which case the object createdby the new-expression has a cv-qualified type. — end note ]74) sizeof(bool) is not required to be 1.75) The actual size of a base class subobject may be less than the result of applying sizeof to the subobject, due to virtualbase classes and less strict padding requirements on base class subobjects.§ 5.3.4© ISO/IEC 2011 – All rights reserved111ISO/IEC 14882:2011(E)new-expression:::opt new new-placementopt new-type-id new-initializeropt::opt new new-placementopt ( type-id ) new-initializeroptnew-placement:( expression-list )new-type-id:type-specifier-seq new-declaratoroptnew-declarator:ptr-operator new-declaratoroptnoptr-new-declaratornoptr-new-declarator:[ expression ] attribute-specifier-seqoptnoptr-new-declarator [ constant-expression ] attribute-specifier-seqoptnew-initializer:( expression-listopt )braced-init-listEntities created by a new-expression have dynamic storage duration (3.7.4).

[ Note: the lifetime of such anentity is not necessarily restricted to the scope in which it is created. — end note ] If the entity is a nonarray object, the new-expression returns a pointer to the object created. If it is an array, the new-expressionreturns a pointer to the initial element of the array.2If the auto type-specifier appears in the type-specifier-seq of a new-type-id or type-id of a new-expression, thenew-expression shall contain a new-initializer of the form( assignment-expression )The allocated type is deduced from the new-initializer as follows: Let e be the assignment-expression in thenew-initializer and T be the new-type-id or type-id of the new-expression, then the allocated type is the typededuced for the variable x in the invented declaration (7.1.6.4):T x(e);[ Example:new auto(1);auto x = new auto(’a’);// allocated type is int// allocated type is char, x is of type char*— end example ]3The new-type-id in a new-expression is the longest possible sequence of new-declarators.

[ Note: this preventsambiguities between the declarator operators &, &&, *, and [] and their expression counterparts. — endnote ] [ Example:new int * i;// syntax error: parsed as (new int*) i, not as (new int)*iThe * is the pointer declarator and not the multiplication operator.

— end example ]4[ Note: parentheses in a new-type-id of a new-expression can have surprising effects. [ Example:new int(*[10])();// erroris ill-formed because the binding is(new int) (*[10])();// errorInstead, the explicitly parenthesized version of the new operator can be used to create objects of compoundtypes (3.9.2):§ 5.3.4112© ISO/IEC 2011 – All rights reservedISO/IEC 14882:2011(E)new (int (*[10])());allocates an array of 10 pointers to functions (taking no argument and returning int. — end example ]— end note ]5When the allocated object is an array (that is, the noptr-new-declarator syntax is used or the new-type-id ortype-id denotes an array type), the new-expression yields a pointer to the initial element (if any) of the array.[ Note: both new int and new int[10] have type int* and the type of new int[i][10] is int (*)[10]— end note ] The attribute-specifier-seq in a noptr-new-declarator appertains to the associated array type.6Every constant-expression in a noptr-new-declarator shall be an integral constant expression (5.19) andevaluate to a strictly positive value.

Характеристики

Тип файла
PDF-файл
Размер
14,26 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов учебной работы

Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6480
Авторов
на СтудИзбе
303
Средний доход
с одного платного файла
Обучение Подробнее