0
点赞
收藏
分享

微信扫一扫

封装boost::format


封装boost::format



boost::format()大量使用,只是函数名太长了点,需要简化。
原因2就是希望Release版不要因为格式化参数多了少了而抛异常。
原因3就是boost::format中有文件包含特殊字符,出C4819警告。

// fmt.h
#ifndef __FMT_H__
#define __FMT_H__

#pragma warning( push )
#pragma warning( disable: 4819 )
// Disable boost/format/alt_sstream_impl.hpp : warning C4819: ...
#include <boost/format.hpp>
#pragma warning( pop )

namespace {

boost::format fmt(const std::string & sFmt)
{
    boost::format fmter(sFmt);
#ifdef NDEBUG
    fmter.exceptions(boost::io::no_error_bits);
#endif    
    return fmter;
}

}  // namespace

#endif  // __FMT_H__


举报

相关推荐

0 条评论