⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 check_type.hpp

📁 boost库提供标准的C++ API 配合dev c++使用,功能更加强大
💻 HPP
字号:

//  (C) Copyright John Maddock 2000. 
//  Use, modification and distribution are subject to the 
//  Boost Software License, Version 1.0. (See accompanying file 
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef BOOST_CHECK_TYPE_HPP
#define BOOST_CHECK_TYPE_HPP

#include <boost/test/test_tools.hpp>
#include <boost/type_traits/is_same.hpp>

/*
macro:
BOOST_CHECK_TYPE(type_expression, expected_type)

type_expression:  an expression that evaluates to a typename.
expected_value:   the type we expect to find.
*/

#ifdef __BORLANDC__
#pragma option -w-8008 -w-8066 -w-8019
#endif


#define BOOST_CHECK_TYPE(type_expression, expected_type)\
do{\
   if(!::boost::is_same< type_expression, expected_type >::value){\
   BOOST_CHECK_MESSAGE(false, "The expression: \"" << BOOST_STRINGIZE(expression)\
      << "\" did not have the expected type:\n\tevaluating:   boost::is_same<"\
      << BOOST_STRINGIZE(type_expression) << ", " << BOOST_STRINGIZE(expected_type)\
      << ">" << "\n\tfound:        "\
      << typeid(::boost::is_same< type_expression, expected_type >).name());\
   }else\
      BOOST_CHECK_MESSAGE(true, "Validating Type Expression: \""\
         << BOOST_STRINGIZE(expression) << "\"");\
}while(0)

#endif


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -