08 2019 档案
摘要:unique_ptr, shared_ptr 以及weak_ptr 1. example unique_ptr 与所指对象的内存绑定紧密,不能与其他unique_ptr类型的指针对象共享所值对象的内存。up2不能分享up1的所有权。这种所有权只能通过move()函数来转移。 shared_ptr允许
阅读全文
摘要:1. 枚举:分本别类和数值的名字 程序中需要“数值的名字”时,有三种方式实现: (1)宏 #define Male 0 #define Female 1 (2)匿名的enum enum { Male, Female }; (3)静态常量 const static int Male = 0; cons
阅读全文
摘要:1. example code 变量 j 的类型由decltype(i)进行声明,表示 j 的类型跟 i 相同(或者准确的说,是与 i 这个表达式返回的类型相同)。而类型c则跟(a+b)这个表达式返回的类型相同。decltype总是以一个普通的表达式为参数,返回该表达式的类型。decltype的类型
阅读全文
摘要:转:https://www.cnblogs.com/DswCnblog/p/5629165.html C++11的一大亮点就是引入了Lambda表达式。利用Lambda表达式,可以方便的定义和创建匿名函数。对于C++这门语言来说来说,“Lambda表达式”或“匿名函数”这些概念听起来好像很深奥,但很
阅读全文
摘要:1. 临时变量的拷贝 使用g++编译,不使用优化:g++ -std=c++11 -fno-elide-constructors test.cpp -o main 输出为: Construct: 1 Resource from GetTemp: 0x25d5c20 Move constructor:
阅读全文
摘要:UUIDs are used by distributed systems that have to uniquely identify components. For example, Microsoft uses UUIDs to identify interfaces in the COM w
阅读全文
摘要:Archive An archive is a sequence of bytes that represented serialized C++ objects. Objects can be added to an archive to serialize them and then later
阅读全文
摘要:Boost.Integer defines specialized for integers. 1. types for integers with number of bits output: 1 8 1 4 1 8 types such as boost::int8_t and boost::u
阅读全文
摘要:boost exception provides a new exception type, that lets you add data to an exception after it has been thrown. output: unction write_lots_of_zeros()
阅读全文
摘要:boost::system::error_code is the most basic class in Boost.System; it represents operating system-specific errors. Because operating systems typically
阅读全文
摘要:Boost.Lockfree provides thread-safe and lock-free containers. Containers from this library can be accessed from multiple threads without having to syn
阅读全文
摘要:boost::atomic can be used to create atomic variables. They are called atomic variables because all access is atomic. Boost.Atomic is used in multithre
阅读全文
摘要:1. thread The name of the function that the new thread should execute is passed to the constructor of boost::thread. Once the variable t is created, t
阅读全文
摘要:boost::function to encapsulate function pointers. 1. function boost::function makes it possible to define a pointer to a function with a specific sign
阅读全文
摘要:In functional programming, functions are objects and can be processed like objects. With Boost.Phoenix, it is possible for a function to return anothe
阅读全文
摘要:Boost.Timer provides clocks to measure code performance. At first, it may seem like this library competes with Boost.Chrono. However, while Boost.Chro
阅读全文
摘要:1. local_date_time The constructor of boost::local_time::local_date_time expects its first parameter to be an object of type boost::posix_time::ptime
阅读全文
摘要:The class boost::posix_time::ptime defindes a location-independent time. It uses the type boost::gregorian::date, but also stores a time. 1. ptime To
阅读全文
摘要:To create a date, use the class boost::gregorian::date 1. date boost::gregorian::date provides several constructors to create dates. The most basic co
阅读全文
摘要:The library Boost.Filesystem makes it easy to work with files and directories. Paths Paths can be build by passing a string to the constructor of boos
阅读全文
摘要:Boost.IOStreams provides numerous implementations of the two concepts. Devices which describes data sources and sinks, and stream which describes an i
阅读全文

浙公网安备 33010602011771号