Studying about "noexcept specifier(and operator)", I wrote a simple code. And I am surprised that this piece of code:
void asdf() noexcept {}
int main()
{
auto f = asdf;
std::cout << std::boolalpha << noexcept(f()) << std::endl;
}
prints false, even function "asdf" is noexcept-specified.
So while searching why this mysterious phenomenon is happening, I found C++17's "exception specifier type system"- P0012R1.
According to this (accepted) proposal, since C++17; as noexcept is part of function type, will the code above print true?
And one more, in this question's one line:
std::function<void() noexcept> f
The noexcept specifying seems ignored in C++14 or 11. Will this code work as intended in C++17?
Aucun commentaire:
Enregistrer un commentaire