Boost logo

Boost Users :

From: Pavel Syomin (syomin_at_[hidden])
Date: 2007-07-25 02:01:23


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?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net