2014-04-25 17:15 GMT+02:00 Andrey Semashev
On Friday 25 April 2014 17:09:03 Andrzej Krzemienski wrote:
Hi, Although I am not entirely convinced that any not throwing function (except for moves) should be marked as noexcept, I can see that noexcept starts to get into Boost. explicit operator bool appears to be a good candidate, but macro BOOST_EXPLICIT_OPERATOR_BOOL does not offer it. So I have to choose: use the macro or noexcept.
Perhaps the macro could be expanded to give an option to add noexcept, but that would spawn two macros (BOOST_EXPLICIT_OPERATOR_BOOL and BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL) into four.
Are four macros for almost the same purpose acceptable? Or do I have to abandon the idea of making the operator noeaxcept. Are there any recommendations?
I think, noexcept could be added to the existing macros rather safely using BOOST_NOEXCEPT_IF/BOOST_NOEXCEPT_EXPR. I could do it if no one objects.
Yes, make it noexcept if operator! is noexcept. That couldn't possibly hurt anyone.