- 博客(37)
- 收藏
- 关注
原创 最近的状况
记录一下最近的情况。 Boost系列不想继续剖析,继续写了。一来是觉得“一门语言掌握的再精通也是肤浅的”,即时你是做编译器的。二来,boost里面的东西并不一定都是我们值得借鉴的,以type_traits为例,完全以宏的方式完成了各种组件,使读代码的人摸不着北,再说说boost.tuple,他通过宏开关,实现了三种以上(如果我没看挫)的解决方案,并且存在了太多的垃圾代码(枚举了1到20个数
2007-10-28 23:50:00
636
原创 boost.tuple源码整理和使用说明
IntroductionA tuple (or n-tuple) is a fixed size collection of elements. Pairs, triples, quadruples etc. are tuples. In a programming language, a tuple is a data object containing other objects as e
2007-10-07 23:13:00
796
原创 泛型插入排序
#pragma once#include #include template class bidirectional_iterator, templateclass> class greater_compare = std::greater > class insertion_sort_functor {
2007-09-18 00:25:00
676
原创 泛型归并排序
#define SENTINEL_CARD (-1) #include #include #include #include #include template class bidirectional_iterator, template class> class less_equal_compare = std::less
2007-09-18 00:23:00
597
转载 为什么C++
为什么C++(感谢waterwalk翻译) 刘未鹏(pongba) /文waterwalk /译C++的罗浮宫(http://blog.youkuaiyun.com/pongba) 首先非常感谢waterwalk的辛勤翻译:-) waterwalk把翻译回贴在原文的下面了,为了方便阅读我提取出来编辑以后重发一个帖子。这篇文章原本是想对最近C/C++争论系统的整理一下一些思考的,但由于一
2007-09-18 00:16:00
697
2
转载 瘦身前后——兼谈语言进化
瘦身前后——兼谈语言进化 By 刘未鹏(pongba)C++的罗浮宫(http://blog.youkuaiyun.com/pongba) 《C++0x漫谈》系列导言 这个系列其实早就想写了,断断续续关注C++0x也大约有两年余了,其间看着各个重要proposals一路review过来:rvalue-references,concepts,memory-model,varia
2007-09-18 00:13:00
686
转载 《C++0x漫谈》系列之:多线程内存模型
《C++0x漫谈》系列之:多线程内存模型 By 刘未鹏(pongba)刘言|C++的罗浮宫(http://blog.youkuaiyun.com/pongba) 《C++0x漫谈》系列导言 这个系列其实早就想写了,断断续续关注C++0x也大约有两年余了,其间看着各个重要proposals一路review过来:rvalue-references、concepts、memory-
2007-09-18 00:11:00
731
转载 《C++0x漫谈》系列之:Auto的故事
《C++0x漫谈》系列之:Auto的故事 By 刘未鹏(pongba)C++的罗浮宫(http://blog.youkuaiyun.com/pongba) 《C++0x漫谈》系列导言 这个系列其实早就想写了,断断续续关注C++0x也大约有两年余了,其间看着各个重要proposals一路review过来:rvalue-references,concepts,memory-mod
2007-09-18 00:09:00
645
原创 最近的状态
“Design Pattern”读完了,感慨颇多。准备在不久的将来把手头的项目做完了重读一遍。 最近又在读“Thinking in Java”,想速度了解一遍java语言,开阔视野。 最近一门新语言走入了我的视线:The D Programming Language。准备关注它了。我注意到了一个细节,D的编译器DMD把代码编译成obj文件后,调用DMC链接器(一个C/C++链接器)
2007-09-18 00:01:00
557
原创 Abstract Factory
Abstract FactoryProblem DescriptionThe scenario is in a game, where there are enemies like tanks, airplanes, automobiles and bosses, items like medicines, bullets. This game has two levels: ea
2007-09-02 16:48:00
510
原创 My reading schema for next few months
“C++ Template Meta-programming”“Applied Boost and the Annotated Boost”“Design Pattern”“Head First Design Pattern”C++ Meta Programming and Boost MPLException Handling - A False Sense of S
2007-08-30 23:31:00
585
转载 C++ Meta Programming 和 Boost MPL(4)
本系列全部转载自kuibyshev.bokee.com1. Boost中的MPL库分析MPL是由David Abrahams和Aleksey Gurtovoy为方便模板元编程而开发的库,2003年被Boost吸纳为其中的一员,此后又历经一些大幅度修改,目前已经相当完善,其最新版本于2004年11月发布。MPL的出现是C++模板元编程发展中的一大创举,它提供了一个通用、高层次的编程
2007-08-30 23:07:00
1474
转载 C++ Meta Programming 和 Boost MPL(3)
本系列全部转载自kuibyshev.bokee.com1. 模板元编程的基本用途1.1. 数值计算上文提及的所有关于模板元编程的例子都是在编译时的数值计算,这是模板元编程的最简单直接的使用方法。数值计算主要利用模板的特化和局部特化能力进行递归演算,模板类被视为元函数,利用类中的一个静态常量保存结果。由于C++模板对非类型的参数有限制,一般只有整型和布尔型可以参加运算。元
2007-08-30 23:06:00
2608
转载 C++ Meta Programming 和 Boost MPL(2)
本系列全部转载自kuibyshev.bokee.com 1. 模板元编程的原理1.1. 函数式编程1.1.1. 函数式编程的概念从上面的例子可以看出,由于模板元编程借助的是C++模板的特化能力,使它的设计方法迥异于普通的C++编程习惯。比如我们不能够在元函数中使用变量,编译期显然只可能接受静态定义的常量,也就因此,我们不能够使用传统意义上的循环;要实现任何分支选择,
2007-08-30 23:02:00
1264
转载 C++ Meta Programming 和 Boost MPL(1)
本系列全部转载自kuibyshev.bokee.com1. 引论C++的发展史是一个不断吸收程序设计领域精华和不断积累充实语言特性的过程。它的创造者Stroustrup在这门新的编程语言草创之初就定下了几个基本的目标,二十年过去了,至今这些目标仍然是C++继续发展的指南针。其中他明确指出,这种语言不应强迫程序员使用单一程序设计形式[20];就是说C++语言应该是一种“多种花样”的
2007-08-30 23:01:00
1394
1
转载 智能指针的标准之争:Boost vs. Loki
智能指针的标准之争:Boost vs. Loki撰文/马维达 weida@flyingdonkey.com2001 年10 月和2002 年4 月,在美国的华盛顿和荷兰的安的列斯群岛上分别召开了两次C++标准会议。会议的内容之一是对一项新的C++特性提议——智能指针(Smart Pointer)——进行讨论。本文将对可能成为C++新标准的两种智能指针方案(Boost vs. Lok
2007-08-28 12:28:00
1151
2
原创 我看国内的C++教育以及我的建议
学习C++,是因为效率。学习C++,是为了对底层更牢固的控制力。学习C++,是因为这里才存在真正的泛型。。。。。。。 可是我,有点郁闷,学习C++,是为了学习MFC。MFC衰落了,但是C++并没有,C++0x将是C++历史上的第二次革命,boost组件的加入必将把generic programming和template meta programming推崇到极致,程序员不必把它
2007-08-28 11:26:00
1266
1
原创 泛型快速排序
Source#ifndef kimi_quicksort#define kimi_quicksort #include #include #include namespace kimi_boost{ using namespace std; templateclass RandomAccessIterator>void quickso
2007-08-28 03:20:00
821
原创 boost.type_traits源码整理和使用说明(1)
IntroductionThe Boost type-traits library contains a set of very specific traits classes, each of which encapsulate a single trait from the C++ type system; for example, is a type a pointer or a ref
2007-08-28 01:35:00
1090
原创 编译期判断类的继承性
介绍一个雕虫小技:编译期判断类的继承性。具体来说就是类型U是否继承自类型T。该技术的灵感和源头来自Andrei Alexandrescue的《Modern C++ Design》。原书中描述的此技术有一个小小的bug。源代码template class T , class U>class __conversion{ static char test(U); stat
2007-08-24 23:00:00
886
原创 boost.lexical_cast源码整理和使用说明
Source#include #include #include //#include #include #include #include #include //namespace kimi_boost{ // exception used to indicate runtime lexical_cast failure
2007-08-24 22:55:00
980
原创 boost.shared_ptr源码整理和使用说明
Source#pragma once //shared_ptr的简单实现版本//基于引用记数的智能指针//它可以和stl容器完美的配合namespace kimi_boost{ templateclass T> class shared_ptr{public: typedef T element_type; typedef T v
2007-08-24 22:51:00
1286
原创 boost.BOOST_STATIC_ASSERT源码整理和使用说明
Source#include #include //namespace kimi_boost{ //这个模板类只有声明,没有定义 //注意:这里没有{} //所以如果定义这个类型的对象将会失败 template bool> struct STATIC_ASSERTION_FAILURE2;
2007-08-24 22:49:00
768
原创 boost.array源码整理和使用说明
Source#include #include #include // Handles broken standard libraries better than #include #include #include // FIXES for broken compilers#include namespace kimi_boost
2007-08-24 22:45:00
570
原创 boost.any源码整理和使用说明
Source#include #include #include "boost/config.hpp"#include #include #include #include namespace kimi_boost{ class any { templatetypename ValueType>
2007-08-24 22:44:00
898
原创 main函数的三种参数形式
main函数的返回值可以是任意类型,包括void。main函数的参数列表可以是一下三种形式:main(void)main(int argc, char* argv[])main(int argc, char* argv[], char* envp[])envp数组用来接收系统的环境变量
2007-08-23 23:15:00
1908
原创 没有完美的strcpy
strcpy的几个焦点集中在一下几点:是否效率优先NULL指针处理重叠(源和目的相同是其一种特殊情况)处理字符串结束字符字符类型效率优先版本extern "C" char * unchecked_strcpy(char *d,const char *s ){ //the simplest and most efficient way assert(d
2007-08-13 20:12:00
650
转载 JavaScript:世界上误解最深的语言
JavaScript,是世界上最流行的编程语言之一。事实上世界上的每一台个人电脑都安装并在频繁使用至少一个JavaScript解释器。JavaScript的流行完全是由于他在WWW脚本语言领域中的地位决定的。 Despite its popularity, few know that JavaScript is a very nice dynamic object-oriented gen
2007-08-13 11:33:00
567
转载 你应当如何学习C++(以及编程)
你应当如何学习C++(以及编程)(rev#1) By 刘未鹏(pongba)C++的罗浮宫(http://blog.youkuaiyun.com/pongba) Javascript是世界上最受误解的语言,其实C++何尝不是。坊间流传的错误的C++学习方法一抓就是一大把。我自己在学习C++的过程中也走了许多弯路,浪费了不少时间。 为什么会存在这么多错误认识?原因主要有三个,一是C+
2007-08-05 10:17:00
794
2
转载 《C++0x漫谈》系列之:Concept, Concept!
《C++0x漫谈》系列之:Concept, Concept! By 刘未鹏(pongba) 《C++0x漫谈》系列导言 这个系列其实早就想写了,断断续续关注C++0x也大约有两年余了,其间看着各个重要proposals一路review过来:rvalue-references,concepts,memory-model,variadic-templates,templ
2007-08-05 10:10:00
619
转载 《C++0x漫谈》系列之:右值引用或“move语意与完美转发”(下)
《C++0x漫谈》系列之:右值引用或“move语意与完美转发”(下)By 刘未鹏(pongba)刘言|C++的罗浮宫(http://blog.youkuaiyun.com/pongba)《C++0x漫谈》系列导言这个系列其实早就想写了,断断续续关注C++0x也大约有两年余了,其间看着各个重要proposals一路review过来:rvalue-references、c
2007-08-05 09:53:00
763
转载 《C++0x漫谈》系列之:右值引用或“move语意与完美转发”(上)
《C++0x漫谈》系列之:右值引用或“move语意与完美转发”(上) By 刘未鹏(pongba) 《C++0x漫谈》系列导言 这个系列其实早就想写了,断断续续关注C++0x也大约有两年余了,其间看着各个重要proposals一路review过来:rvalue-references、concepts、memory-model、variadic-templates、t
2007-08-05 09:45:00
1212
原创 一个STL风格的动态二维数组
#ifndef __KIMI_BOOST_ARRAY2#define __KIMI_BOOST_ARRAY2#pragma once#include //size_t#include //exception#include //random_access_iterator_tag,reverse_iteratornamespace kimi_boost{template class a
2007-07-22 18:05:00
1274
2
原创 boost.pool源码整理和使用说明
Source#ifndef __KIMI_BOOST_POOL#define __KIMI_BOOST_POOL#pragma once // std::less, std::less_equal, std::greater#include // new[], delete[], std::nothrow#include // std::size_t, s
2007-07-22 13:49:00
1626
转载 C#中const与readonly字段的区别
const和readonly的值一旦初始化则都不再可以改写; const只能在声明时初始化;readonly既可以在声明时初始化也可以在构造器中初始化; const隐含static,不可以再写static const;readonly则不默认static,如需要可以写static readonly; const是编译期静态解析的常量(因此其表达式必须
2007-02-11 11:32:00
615
原创 C# - Ini文件类
namespace database{ using System.Runtime.InteropServices; using System.Text; public class Ini { [DllImport("kernel32.dll")] private static extern long WritePrivateProfileString(string section,
2007-02-11 10:43:00
814
原创 C# - Rijndael文件加密类
using System;using System.Security.Cryptography;using System.IO; public class Rijndael { //data members private string m_InFileName; private string m_OutFileName; private byte[] m_Key = { 0x01,
2007-02-11 10:33:00
903
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人