mirror of
https://github.com/boostorg/type_index.git
synced 2025-07-29 20:07:18 +02:00
Use lightweight tests to avoid Boost.Test warnings, RTTI issues and minimize compilation times
This commit is contained in:
@ -14,13 +14,14 @@
|
||||
#include <boost/unordered_set.hpp>
|
||||
#include <boost/functional/hash.hpp>
|
||||
//<-
|
||||
// Making `#include <cassert>` visible in docs, while actually using hand-made check
|
||||
// Making `#include <cassert>` visible in docs, while actually using `BOOST_TEST`
|
||||
// instead of `assert`. This is required to verify correct behavior even if NDEBUG
|
||||
// is defined and to avoid `unused local variable` warnings with defined NDEBUG.
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#ifdef assert
|
||||
# undef assert
|
||||
#endif
|
||||
#define assert(X) if (!(X)) std::exit(__LINE__)
|
||||
#define assert(X) BOOST_TEST(X)
|
||||
/* !Comment block is not closed intentionaly!
|
||||
//->
|
||||
#include <cassert>
|
||||
|
@ -18,17 +18,14 @@
|
||||
#include <boost/type_index.hpp>
|
||||
//] [/type_index_my_type_index_worldwide_macro]
|
||||
|
||||
|
||||
|
||||
using namespace my_namespace;
|
||||
//<-
|
||||
// Using hand-made check
|
||||
// instead of `assert`. This is required to verify correct behavior even if NDEBUG
|
||||
// is defined and to avoid `unused local variable` warnings with defined NDEBUG.
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#ifdef assert
|
||||
# undef assert
|
||||
#endif
|
||||
#define assert(X) if (!(X)) std::exit(__LINE__)
|
||||
#define assert(X) BOOST_TEST(X)
|
||||
|
||||
|
||||
using namespace my_namespace;
|
||||
|
||||
int main() {
|
||||
//[type_index_my_type_index_usage
|
||||
|
Reference in New Issue
Block a user