Date: Sun, 13 Mar 2022 02:42:34 +0400
Hello All,The '=default ' keyword next to a structure's special functions could be extended to the following:struct needsAhash{ int m_i; SomeComplicatedType m_t; /*define here the necessary Ctors & al*/ ... auto hash(int val) const = std::hash<int>(needsAhash::m_i);};In the above snippet, i mixed a member function declaration with a plain function call.The intention is to tell the compiler to stamp the following:auto hash(int val){ return std::hash<int>(m_i);}auto hash(int val) : is the member function std::hash<int>(needsAhash::m_i) : is the implementation function. The compiler is supposed to copy all the declaration specifiers of the "implementation function" into the member function,.i.e inline, noexcept, constexpr...etc then add on top of them the specifiers declared with the member function. What do you think about this feature?Nadir.
Received on 2022-03-12 22:42:42