共 27 篇文章 |
|
一组用于测试编译器和库对于标准吻合程度的代码库。C++在面向企业的软件开发中,在开发便捷性等方面的确要比Java和C#差很多,其中一个问题是C++语言本身比较复杂,学习曲线比较陡峭,另外一个问题是C++标准化的时间太长,丧失了很多的壮大机会,耗费了很多精力在厂商的之间的斗争上,而C++的标准库离一个完善的程序开发框架还缺少太多太多的内... 阅7 转自一叶扁舟 公众公开 12-08-07 15:28 |
// 函数wstring StringToWstring(const char* ch) char* chr = "中华人民共和国"; cout<<chr[0]<<chr[1]<<" "<<chr<<endl; wstring wstr2 = StringToWstring(chr); wcout<<wstr2[0]<<" "<<wstr2<<endl;// 函数wstring StringToWstring(const string... 阅2320 转18 评0 公众公开 12-03-30 14:54 |
public: malloc_allocator() {} malloc_allocator(const malloc_allocator&) {} ~malloc_allocator() {} private: void operator=(const malloc_allocator&);问题是,一个allocator类,比如 malloc_allocator<int>,全部是围绕着单个value_type构建的:malloc_allocator< int>::pointer是int*,malloc_allocator<int>... 阅430 转1 评0 公众公开 12-03-29 16:51 |
模板类的定义模板类成员的申明和定义(定义可以放在类内或者类外,类外不需要写inline)在头文件中,可以对函数用inline限定符来告知编译器,这段函数非常的简单,可以直接嵌入到调用定义之处。当然inline的函数并不一定会被编译器作为inline来实现,如果函数过于复杂,编译器也会拒绝inline。因此在下边,我把带有inline限定符的函数成员和写... 阅677 转3 评0 公众公开 12-03-28 17:02 |
#include <boost/interprocess/shared_memory_object.hpp>#include <boost/interprocess/mapped_region.hpp>int main(int argc, char* argv[ ]) { using namespace boost::interprocess;#include <boost/interprocess/shared_memory_object.hpp>#include <boost/interprocess/mapped_region.hpp>#include <cstring&... 阅725 转4 评0 公众公开 12-03-25 21:02 |
///等待到有存放的空间 while(mbox->nready == mbox->size ) pthread_cond_wait(&(mbox->not_full),&(mbox->mutex));mbox->msg_array[mbox->last] = msg;mbox->last = (mbox->last+1)%mbox->size;while(0==mbox->nready) pthread_cond_wait(&(mbox->not_empty),&(mbox->mutex));*pmsg = m... 阅1512 转7 评0 公众公开 12-03-23 23:19 |
template<class DataType>class Message_Queue{public: //构造函数,初始化2个互斥锁和1个条件变量 Message_Queue():_nready(0) { pthread_mutex_init(&_mutex, NULL); pthread_mutex_init(&_ready_mutex, NULL); pthread_cond_init(&_cond, NULL); }pthread_mutex_t _ready_mutex;pthread_mut... 阅2227 转36 评0 公众公开 12-03-23 23:18 |
SGI STL是目前应用最为广泛的STL版本了。STLport STL完全可以与SGI STL媲美。如果你已经初步了解了STL的容器、迭代器、算法和函数,而又想更好的了解STL,那么《Effective STL》是你的最佳选择。《STL编程指南》本电子书把SGI STL的相关帮助文档集合在一起,形成chm格式文档,查阅起来非常方便。如果希望全面理解STL内部机制,如果希望真正精通... 阅302 转1 评0 公众公开 12-03-15 22:31 |
vector vs deque - Aeolus Zheng的专栏 - CSDN博客STL Deque 容器翻译:JiangMiao 出处: www.sssdf.com 时间: 2005-08-08What''s Missing我们又可以发现下面两个元素是vector特有的 capacity() - Returns the current capacity of a vector. reserve() - Allocates room for a specified number of elements in a vector. 这里真正的... 阅42 转自weicat 公众公开 12-03-13 15:10 |