decltype(auto)
От: niXman Ниоткуда https://github.com/niXman
Дата: 06.08.17 10:09
Оценка: 2 (1)
привет!

собственно, никогда еще не использовал сабж, и решил ознакомиться, нагуглив такое.

из прочитаного понял, что это для perfectly forward a return type.
и, у меня возник вопрос: получается, что для случаев когда мы явно не хотим чтоб использовался perfectly forward a return type — мы должны указывать возвращаемый тип с квалификаторами? а во всех остальных случаях будет правильным использовать decltype(auto)?


ЗЫ
по ссылке выше есть такая цитата:

1 The auto and decltype(auto) type-specifiers designate a placeholder type that will be replaced later, either by deduction from an initializer or by explicit specification with a trailing-return-type. The auto type-specifier is also used to signify that a lambda is a generic lambda.

2 The placeholder type can appear with a function declarator in the decl-specifier-seq, type-specifier-seq, conversion-function-id, or trailing-return-type, in any context where such a declarator is valid. If the function declarator includes a trailing-return-type (8.3.5), that specifies the declared return type of the function. If the declared return type of the function contains a placeholder type, the return type of the function is deduced from return statements in the body of the function, if any.

тут мне совершенно не понятен второй пункт. может ли кто-нить объяснить это простыми словами, плиз?
пачка бумаги А4 стОит 2000 р, в ней 500 листов. получается, лист обычной бумаги стОит дороже имперского рубля =)
Отредактировано 06.08.2017 10:14 niXman . Предыдущая версия .
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.