![]() |
![]() ![]() ![]() ![]() |
![]() |
The MPL Reference Manual: BOOST_MPL_ASSERTBoost , ,
|
||||||||||||||||||
| Front Page / Macros / Asserts / BOOST_MPL_ASSERT |
#define BOOST_MPL_ASSERT( pred ) \ unspecified token sequence \ /**/
Создает ошибку компиляции, когда предикатPredЛожь.
#include <boost/mpl/assert.hpp>
| Parameter | Requirement | Description |
|---|---|---|
| Pred | Булева нулеваяМетафункция | Предикат, который следует утверждать. |
Для любого нуляраМетафункцияПред:
BOOST_MPL_ASSERT(( pred ));
| Return type: | None. |
|---|---|
| Semantics: | Generates a compilation error if pred::type::value != true, otherwise has no effect. Note that double parentheses are required even if no commas appear in the condition. По возможности в пределах диагностических возможностей компилятора сообщение об ошибке будет включать полное имя типа предиката и иметь общую форму: ... ************ pred::************ ... |
template< typename T, typename U > struct my
{
// ...
BOOST_MPL_ASSERT(( is_same< T,U > ));
};
my<void*,char*> test;
// In instantiation of `my<void, char*>':
// instantiated from here
// conversion from `
// mpl_::failed************boost::is_same<void, char*>::************' to
// non-scalar type `mpl_::assert<false>' requested
Статья The MPL Reference Manual: BOOST_MPL_ASSERT раздела может быть полезна для разработчиков на c++ и boost.
:: Главная :: ::
реклама |