
C/C++开发
lijie0073237
这个作者很懒,什么都没留下…
展开
-
C++ 实现BitMap
C++ 实现BitMap#include <cstdint>class BitMap {private: uint64_t* m_arr; const int32_t RADIX = 64; const int32_t R_SHILT = 6; uint64_t m_maxValue;public: BitMap(uint64_t max_value) : m_maxValue(max_value){ uint32_t b原创 2022-01-16 23:27:46 · 419 阅读 · 0 评论 -
cmake 支持boost
cmake_minimum_required(VERSION 2.8)project(test)SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11")find_package(Boost REQUIRED COMPONENTS regex#filesystem )if(NOT Boost_FOUND) message("...转载 2018-08-05 00:43:25 · 1104 阅读 · 0 评论 -
boost pool库
一. pool库 -> pool P100返回一个简单数据类型(POD)的内存指针,如int、double等. #include <boost/pool/pool.hpp> using namespace boost; int main() { pool<> pl(sizeof(int)); //一个可分配int的内存池原创 2017-02-27 15:05:46 · 272 阅读 · 0 评论 -
boost smart_prt 4-> shared_ptr
shared_ptr P84引用计数型的智能指针 shared_ptr spi(new int); assert(spi); *spi = 253; shared_ptr sps(new string(“smart”)); assert(sps->size() == 5);shared_ptr提供operator<比较操作符,可用于标准关联容器 #include <iostre原创 2017-02-26 12:00:10 · 540 阅读 · 0 评论 -
boost smart_ptr 3-> scoped_array
scoped_array P82 scoped_array 类似scoped_ptr,封装了new[]操作符,为动态数组提供了一个代理 scoped_array<int> sa(new int[100]); sa[0] = 10; *(sa+1) = 20; 除非对性能有非常苛刻的要求,或者编译器不支持标准库,否则不建议使用scoped_array.原创 2017-02-26 11:28:01 · 253 阅读 · 0 评论 -
boost smart_ptr -> scoped_ptr
smart_ptr 库概述 C++98 校准的“自动指针”:std::auto_ptr #include <boost/smart_ptr.hpp> using namespace boost; scoped_ptr P78 只能在本作用域内使用,不希望被转让。a. 不支持比较操作 b. .swap()交换两个scoped_ptr保存的原始指针,高效操作。sc原创 2017-02-25 12:36:26 · 390 阅读 · 0 评论 -
boost 时间与日期
要点一、timer库 P33timer #include <boost/timer.hpp>using namespace boost;progress_timer P36 继承自timer,析构时自动输出时间 #include <boost/progress.hpp>using namespace boost;//将progress_timer的输出转移到时stringst原创 2017-02-24 14:36:01 · 407 阅读 · 0 评论 -
boost::assert学习笔记
P213要点头文件 #include assert.hpp> 默认情况下BOOST_ASSERT宏等同于assert宏,断言表达式为真,即: #define BOOST_ASSERT(expr) assert(expr)。如果参数expr表达式值为true,那么断言成立,程序会继续向下执行,否则断言会引发一个异常。BOOST_ASSERT宏仅会在debug模式下生效。原创 2017-02-24 13:59:33 · 2106 阅读 · 0 评论 -
boost::format常用用法
p167 头文件#include <boost/format.hpp>using namespace boost;一个简单的例子#include <boost/format.hpp>using namespace boost;int main(){ cout<< format("%s:%d+%d=%d\n")%"sum"%1%2%(1+2); format fmt("(%1原创 2017-02-22 16:01:30 · 1594 阅读 · 1 评论 -
boost 字符串与文本处理 -> lexical_cast
lexical_cast P178示例代码 #include <boost/lexical_cast.hpp> int main() { using namespace boost; int x = lexical_cast<int>("100"); long y = lexical_cast<long>("2000");原创 2017-03-03 10:32:50 · 414 阅读 · 0 评论 -
boost库uuid工具
uuid P161可以自定义一个头文件来使用uuid组件//uuids.hpp #include <boost/uuid/uuid.hpp>#include <boost/uuid/uuid_generators.hpp>#include <boost/uuid/uuid_io.hpp>using namespace boost::uuids;#include "uuids.hpp"usin原创 2017-03-02 15:50:41 · 548 阅读 · 0 评论 -
boost::exception
boost::exception 异常 P151 #include <boost/exception/all.hpp> using namespace boost; 代码 #include <string> #include <boost/exception/all.hpp> using namespace boost; struct my_exceptio原创 2017-03-01 16:15:35 · 692 阅读 · 0 评论 -
boost 实用工具
1. noncopyable P1102. typeof P1123. optional P1164. assign5. swap6. singleton 单件模式7. boost.serialzation 单件模式8. tribool --基于三态的布尔逻辑9. operators P140原创 2017-02-27 16:38:03 · 310 阅读 · 0 评论 -
ADO连接SQLServer数据库的连接字
1. 标准方式 ================================================ oConn.Open "Provider=sqloledb;" & _ "Data Source=myServerName;" & _转载 2013-12-15 13:04:52 · 1628 阅读 · 0 评论 -
MFC 非模态对话框覆盖主对话框销毁问题
将Create第二个参数改成GetDesktopWindow()可解决原创 2013-11-07 15:28:39 · 610 阅读 · 0 评论 -
VC 线程编程
转载于 程序风云在用VC6.0写程序调试时,初学者总是会遇到一些错误,针对如下错误主要是因为MFC类库没有引用所出现的问题。错误现象:nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadexnafxcwd.lib(thrdcore.obj) : erro转载 2013-11-20 17:12:27 · 383 阅读 · 0 评论 -
关于sprintf_s第二个参数的用法
int sprintf( char *buffer, const char *format, [ argument] … );int sprintf_s(char *buffer,size_t sizeOfBuffer,const char *format [,argument] ...);sprintf_s第二个参数包含一个NULL字符,比原创 2013-10-31 10:21:41 · 2371 阅读 · 1 评论