在c ++ 14中,decltype(auto)引入了慣用語。通常,它的用途是允許auto聲明使用decltype給定表達式上的規則。在搜索習慣用法的“示例”示例時,我只能想到以下內容(由Scott Meyers撰寫),即函數的返回類型推導:template<typename ContainerType, typename IndexType> // C++14decltype(auto) grab(ContainerType&& container, IndexType&& index){ authenticateUser(); return std::forward<ContainerType>(container)[std::forward<IndexType>(index)];}還有其他使用此新語言功能的示例嗎?
查看完整描述