25 Jul
2007
25 Jul
'07
6:01 a.m.
Hi all! New variant of BOOST_ENFORCE macro: #define BOOST_ENFORCE(expression) \ do { \ if(!(expression)) throw std::invalid_argument( \ __FILE__ " : " BOOST_STRINGIZE(__LINE__) " : " \ + std::string(BOOST_CURRENT_FUNCTION) + \ " : Expression '" #expression "' failed"); \ } while(false) And few question about it: 1. How to escape converting BOOST_CURRENT_FUNCTION to std::string? Is there way to get function name as string literal? 2. Is line number useful information? I think, that filename and function name is good enough. 3. Any observations and suggestions?