﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-CPP&amp;&amp;设计模式小屋-随笔分类-读书笔记</title><link>http://www.cppblog.com/shenhuafeng/category/3024.html</link><description>(STL,Templete,Generric Programming COM,COM+,ActiveX)---Windows &amp;&amp; Linux &amp;&amp;OpenSource
</description><language>zh-cn</language><lastBuildDate>Tue, 20 May 2008 12:53:40 GMT</lastBuildDate><pubDate>Tue, 20 May 2008 12:53:40 GMT</pubDate><ttl>60</ttl><item><title>五种开源协议收藏</title><link>http://www.cppblog.com/shenhuafeng/archive/2007/12/03/37668.html</link><dc:creator>CPP&amp;&amp;设计模式小屋</dc:creator><author>CPP&amp;&amp;设计模式小屋</author><pubDate>Mon, 03 Dec 2007 02:33:00 GMT</pubDate><guid>http://www.cppblog.com/shenhuafeng/archive/2007/12/03/37668.html</guid><wfw:comment>http://www.cppblog.com/shenhuafeng/comments/37668.html</wfw:comment><comments>http://www.cppblog.com/shenhuafeng/archive/2007/12/03/37668.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/shenhuafeng/comments/commentRss/37668.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/shenhuafeng/services/trackbacks/37668.html</trackback:ping><description><![CDATA[<p>当Adobe、Microsoft、Sun等一系列巨头开始表现出对"开源"的青睐时，"开源"的时代即将到来！</p>
<p>出处：<a href="http://www.sinoprise.com/read.php?tid-662-page-e-fpage-1.html"><u><font color=#0000ff>http://www.sinoprise.com/read.php?tid-662-page-e-fpage-1.html</font></u></a>，我没有改动原文，只是进行了一些排版和整理。<br>参考文献：<a href="http://www.fsf.org/licensing/licenses/"><u><font color=#0000ff>http://www.fsf.org/licensing/licenses/</font></u></a></p>
<p>现今存在的开源协议很多，而经过Open Source Initiative组织通过批准的开源协议目前有58种（<a href="http://www.opensource.org/licenses/alphabetical"><u><font color=#0000ff>http://www.opensource.org/licenses/alphabetical</font></u></a>）。我们在常见的开源协议如BSD, GPL, LGPL,MIT等都是OSI批准的协议。如果要开源自己的代码，最好也是选择这些被批准的开源协议。</p>
<p>这里我们来看四种最常用的开源协议及它们的适用范围，供那些准备开源或者使用开源产品的开发人员/厂家参考。</p>
<p><strong>BSD开源协议（</strong><a href="http://www.fsf.org/licensing/licenses/index_html#OriginalBSD"><u><font color=#0000ff><em>original</em> BSD license</font></u></a><strong>、</strong><span class=link-external><a id=FreeBSD href="http://www.freebsd.org/copyright/freebsd-license.html" name=FreeBSD><u><font color=#0000ff>FreeBSD license</font></u></a></span><strong>、</strong><span class=link-external><a id=OriginalBSD href="http://www.xfree86.org/3.3.6/COPYRIGHT2.html#6" name=OriginalBSD><u><font color=#0000ff>Original BSD license</font></u></a></span><strong>）</strong></p>
<p>BSD开源协议是一个给于使用者很大自由的协议。基本上使用者可以"为所欲为",可以自由的使用，修改源代码，也可以将修改后的代码作为开源或者专有软件再发布。</p>
<p>但"为所欲为"的前提当你发布使用了BSD协议的代码，或则以BSD协议代码为基础做二次开发自己的产品时，需要满足三个条件：</p>
<ol>
    <li>如果再发布的产品中包含源代码，则在源代码中必须带有原来代码中的BSD协议。
    <li>如果再发布的只是二进制类库/软件，则需要在类库/软件的文档和版权声明中包含原来代码中的BSD协议。
    <li>不可以用开源代码的作者/机构名字和原来产品的名字做市场推广。 </li>
</ol>
<p>BSD 代码鼓励代码共享，但需要尊重代码作者的著作权。BSD由于允许使用者修改和重新发布代码，也允许使用或在BSD代码上开发商业软件发布和销售，因此是对商业集成很友好的协议。而很多的公司企业在选用开源产品的时候都首选BSD协议，因为可以完全控制这些第三方的代码，在必要的时候可以修改或者二次开发。</p>
<p><strong>Apache Licence 2.0（</strong><span class=link-external><a href="http://www.apache.org/licenses/LICENSE-2.0"><u><font color=#0000ff>Apache License, Version 2.0</font></u></a>、<span class=link-external><a href="http://www.apache.org/LICENSE-1.1"><u><font color=#0000ff>Apache License, Version 1.1</font></u></a>、<span class=link-external><a href="http://www.apache.org/LICENSE-1.0"><u><font color=#0000ff>Apache License, Version 1.0</font></u></a></span></span></span><strong>）</strong></p>
<p>Apache Licence是著名的非盈利开源组织Apache采用的协议。该协议和BSD类似，同样鼓励代码共享和尊重原作者的著作权，同样允许代码修改，再发布（作为开源或商业软件）。需要满足的条件也和BSD类似：</p>
<ol>
    <li>需要给代码的用户一份Apache Licence
    <li>如果你修改了代码，需要再被修改的文件中说明。
    <li>在延伸的代码中（修改和有源代码衍生的代码中）需要带有原来代码中的协议，商标，专利声明和其他原来作者规定需要包含的说明。
    <li>如果再发布的产品中包含一个Notice文件，则在Notice文件中需要带有Apache Licence。你可以在Notice中增加自己的许可，但不可以表现为对Apache Licence构成更改。 </li>
</ol>
<p>Apache Licence也是对商业应用友好的许可。使用者也可以在需要的时候修改代码来满足需要并作为开源或商业产品发布/销售。</p>
<p><strong>GPL（</strong><a id=GNUGPL href="http://www.fsf.org/licensing/licenses/gpl.html" name=GNUGPL><u><font color=#0000ff>GNU General Public License</font></u></a><strong>）</strong></p>
<p>我们很熟悉的Linux就是采用了GPL。GPL协议和BSD, Apache Licence等鼓励代码重用的许可很不一样。GPL的出发点是代码的开源/免费使用和引用/修改/衍生代码的开源/免费使用，但不允许修改后和衍生的代码做为闭源的商业软件发布和销售。这也就是为什么我们能用免费的各种linux，包括商业公司的linux和linux上各种各样的由个人，组织，以及商业软件公司开发的免费软件了。</p>
<p>GPL协议的主要内容是只要在一个软件中使用("使用"指类库引用，修改后的代码或者衍生代码)GPL 协议的产品，则该软件产品必须也采用GPL协议，既必须也是开源和免费。这就是所谓的"传染性"。GPL协议的产品作为一个单独的产品使用没有任何问题，还可以享受免费的优势。</p>
<p>由于GPL严格要求使用了GPL类库的软件产品必须使用GPL协议，对于使用GPL协议的开源代码，商业软件或者对代码有保密要求的部门就不适合集成/采用作为类库和二次开发的基础。</p>
<p>其它细节如再发布的时候需要伴随GPL协议等和BSD/Apache等类似。</p>
<p><strong>LGPL（</strong><a id=LGPL href="http://www.fsf.org/licensing/licenses/lgpl.html" name=LGPL><u><font color=#0000ff>GNU Lesser General Public License</font></u></a><strong>）</strong></p>
<p>LGPL是GPL的一个为主要为类库使用设计的开源协议。和GPL要求任何使用/修改/衍生之GPL类库的的软件必须采用GPL协议不同。LGPL允许商业软件通过类库引用(link)方式使用LGPL类库而不需要开源商业软件的代码。这使得采用LGPL协议的开源代码可以被商业软件作为类库引用并发布和销售。</p>
<p>但是如果修改LGPL协议的代码或者衍生，则所有修改的代码，涉及修改部分的额外代码和衍生的代码都必须采用LGPL协议。因此LGPL协议的开源代码很适合作为第三方类库被商业软件引用，但不适合希望以LGPL协议代码为基础，通过修改和衍生的方式做二次开发的商业软件采用。</p>
<p>GPL/LGPL都保障原作者的知识产权，避免有人利用开源代码复制并开发类似的产品</p>
<p><strong>MIT（<a href="http://www.opensource.org/licenses/mit-license.php"><u><font color=#0000ff>MIT</font></u></a>）</strong></p>
<p align=justify>MIT是和BSD一样宽范的许可协议,作者只想保留版权,而无任何其他了限制.也就是说,你必须在你的发行版里包含原许可协议的声明,无论你是以二进制发布的还是以源代码发布的.</p>
<img src ="http://www.cppblog.com/shenhuafeng/aggbug/37668.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/shenhuafeng/" target="_blank">CPP&&设计模式小屋</a> 2007-12-03 10:33 <a href="http://www.cppblog.com/shenhuafeng/archive/2007/12/03/37668.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>常用编码详解（转自VCKBASE）作者：李静南</title><link>http://www.cppblog.com/shenhuafeng/archive/2007/07/24/28689.html</link><dc:creator>CPP&amp;&amp;设计模式小屋</dc:creator><author>CPP&amp;&amp;设计模式小屋</author><pubDate>Tue, 24 Jul 2007 04:43:00 GMT</pubDate><guid>http://www.cppblog.com/shenhuafeng/archive/2007/07/24/28689.html</guid><wfw:comment>http://www.cppblog.com/shenhuafeng/comments/28689.html</wfw:comment><comments>http://www.cppblog.com/shenhuafeng/archive/2007/07/24/28689.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.cppblog.com/shenhuafeng/comments/commentRss/28689.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/shenhuafeng/services/trackbacks/28689.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 摘要：本文在对各种资料整理后详细介绍各种常见编码的转换算法。一、通用字符集（UCS）ISO/IEC 10646-1 [ISO-10646]定义了一种多于8比特字节的字符集，称作通用字符集（UCS），它包含了世界上大多数可书写的字符系统。已定义了两种多8比特字节编码，对每一个字符采用四个8比特字节编码的称为UCS-4，对每一个字符采用两个8比特字节编码的称为UCS-2。它们仅能够对U...&nbsp;&nbsp;<a href='http://www.cppblog.com/shenhuafeng/archive/2007/07/24/28689.html'>阅读全文</a><img src ="http://www.cppblog.com/shenhuafeng/aggbug/28689.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/shenhuafeng/" target="_blank">CPP&&设计模式小屋</a> 2007-07-24 12:43 <a href="http://www.cppblog.com/shenhuafeng/archive/2007/07/24/28689.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>模版偏特化--Partial Template Specialization(《Modern C++ Design读书笔记二》)</title><link>http://www.cppblog.com/shenhuafeng/archive/2006/12/30/17041.html</link><dc:creator>CPP&amp;&amp;设计模式小屋</dc:creator><author>CPP&amp;&amp;设计模式小屋</author><pubDate>Sat, 30 Dec 2006 09:30:00 GMT</pubDate><guid>http://www.cppblog.com/shenhuafeng/archive/2006/12/30/17041.html</guid><wfw:comment>http://www.cppblog.com/shenhuafeng/comments/17041.html</wfw:comment><comments>http://www.cppblog.com/shenhuafeng/archive/2006/12/30/17041.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cppblog.com/shenhuafeng/comments/commentRss/17041.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/shenhuafeng/services/trackbacks/17041.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Partial Template Specialization顾名思义，模版偏特化就是对模版进行特化的意思。举个例子：namespace SHFTest{    template&lt;            class PLA,            class PLB            &gt;    class PLClass    {        //        // 一般实现 ...&nbsp;&nbsp;<a href='http://www.cppblog.com/shenhuafeng/archive/2006/12/30/17041.html'>阅读全文</a><img src ="http://www.cppblog.com/shenhuafeng/aggbug/17041.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/shenhuafeng/" target="_blank">CPP&&设计模式小屋</a> 2006-12-30 17:30 <a href="http://www.cppblog.com/shenhuafeng/archive/2006/12/30/17041.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>已经看的，正在看的和想看的书籍</title><link>http://www.cppblog.com/shenhuafeng/archive/2006/12/30/17039.html</link><dc:creator>CPP&amp;&amp;设计模式小屋</dc:creator><author>CPP&amp;&amp;设计模式小屋</author><pubDate>Sat, 30 Dec 2006 08:14:00 GMT</pubDate><guid>http://www.cppblog.com/shenhuafeng/archive/2006/12/30/17039.html</guid><wfw:comment>http://www.cppblog.com/shenhuafeng/comments/17039.html</wfw:comment><comments>http://www.cppblog.com/shenhuafeng/archive/2006/12/30/17039.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/shenhuafeng/comments/commentRss/17039.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/shenhuafeng/services/trackbacks/17039.html</trackback:ping><description><![CDATA[
		<p>最近已经完成阅读的书：《STL源码剖析》--侯捷<br />                                            《TCP/IP详解》第一卷<br /><br />最近准备阅读的书：《Moden C++ Design》英文版--<br />                                    电子书（最好有Template基础和看过《设计模式》）<br />                                   《代码大全》--上次看了5章<br />                                   《深入探索C++对象模型》<br /><br />将要看的书：《TCP/IP详解》第二卷和第三卷。<br />                       《应用密码学》<br /><br />很希望和大家做交流，我把《Moden C++ Design》英文版上传到我的文件里面了，需要的朋友自取。<br /></p>
<img src ="http://www.cppblog.com/shenhuafeng/aggbug/17039.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/shenhuafeng/" target="_blank">CPP&&设计模式小屋</a> 2006-12-30 16:14 <a href="http://www.cppblog.com/shenhuafeng/archive/2006/12/30/17039.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>代码大全（一）--理想的设计特征</title><link>http://www.cppblog.com/shenhuafeng/archive/2006/11/16/15201.html</link><dc:creator>CPP&amp;&amp;设计模式小屋</dc:creator><author>CPP&amp;&amp;设计模式小屋</author><pubDate>Thu, 16 Nov 2006 02:14:00 GMT</pubDate><guid>http://www.cppblog.com/shenhuafeng/archive/2006/11/16/15201.html</guid><wfw:comment>http://www.cppblog.com/shenhuafeng/comments/15201.html</wfw:comment><comments>http://www.cppblog.com/shenhuafeng/archive/2006/11/16/15201.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/shenhuafeng/comments/commentRss/15201.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/shenhuafeng/services/trackbacks/15201.html</trackback:ping><description><![CDATA[
		<p>最近开始读《代码大全》，讲到了软件设计。书上讲得其实很对，软件设计就是从架构师设计的架构上构建这个系统，一套好的设计方案就是在各种相互竞争的目标中做折衷。<br /><br />优秀的设计应该具有以下的特征：<br />最小复杂度<br />易于维护<br />松散耦合<br />可扩展性<br />可重用性<br />高扇入：就是大量类使用某个给定的类。这就意味着需要多多使用工具类。<br />低扇出：不要过分使用和依赖于其他的类<br />可移植性<br />精简性<br />层次性<br />标准技术<br /></p>
<img src ="http://www.cppblog.com/shenhuafeng/aggbug/15201.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/shenhuafeng/" target="_blank">CPP&&设计模式小屋</a> 2006-11-16 10:14 <a href="http://www.cppblog.com/shenhuafeng/archive/2006/11/16/15201.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Modern C++ Design 学习笔记之Policy Based Class Design</title><link>http://www.cppblog.com/shenhuafeng/archive/2006/09/13/12426.html</link><dc:creator>CPP&amp;&amp;设计模式小屋</dc:creator><author>CPP&amp;&amp;设计模式小屋</author><pubDate>Wed, 13 Sep 2006 15:22:00 GMT</pubDate><guid>http://www.cppblog.com/shenhuafeng/archive/2006/09/13/12426.html</guid><wfw:comment>http://www.cppblog.com/shenhuafeng/comments/12426.html</wfw:comment><comments>http://www.cppblog.com/shenhuafeng/archive/2006/09/13/12426.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cppblog.com/shenhuafeng/comments/commentRss/12426.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/shenhuafeng/services/trackbacks/12426.html</trackback:ping><description><![CDATA[
		<p>版权所有 未经作者允许 不得用于商业用途 转载请附带这第一,二行<br /><a href="/shenhuafeng/">http://www.cppblog.com/shenhuafeng/</a></p>
		<p>Modern C++ Design的第一章就是Policy Based Class Design,可见该技术是整个Loki库的设计基础.这种方式的优点是能够增加程序库的弹性和提高复用性.<br />简单来说就是,一个Policy Based Class由很多基本的Policy来组成的,每个Policy Class代表了该复杂类(相对复杂)类的某些行为或者特性.有点类似于类的继承，当然和类的继承是不同的。<br />那么Policy Based Class有什么用呢？我们先看下面这个问题。<br />假如需要设计一个基础库，可能是基于某个特定领域的，那么库的设计者就需要考虑这样的问题，他需要将未来的可能的需求加以分类，抽象出层次，然后运用OO思想，希望能够构造出一个开发的结构，当然其中的component的设计当然是越是灵活越好。<br />用传统的OO设计思想，可能可以设计出一套非常完善的类库 ，可能包罗万象。当然的对于应用开发人员需要花很多时间去学习这个“包罗万象”的基础类库。而且往往这样的基础库不是通用性不强就是限制条件太多（例如MFC）可以说就是这样一种类型的库。</p>
		<p>下面要展示一下运用多重继承以及Templetes来实现的policy class,举一个简单的例子：<br />假如我们需要发明一个灯，它有不同的种类，有使用不同能源的工作方式以及有不同的操作方式，如果运用</p>
		<p>policy based class来设计的话，可能是这样的结构：<br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #008080"> 1</span>
				<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">templete</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080"> 2</span>
				<span style="COLOR: #000000">
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />    </span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> T,<br /></span>
				<span style="COLOR: #008080"> 3</span>
				<span style="COLOR: #000000">
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />    templete </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> Work,<br /></span>
				<span style="COLOR: #008080"> 4</span>
				<span style="COLOR: #000000">
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />    templete </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> OpMethod<br /></span>
				<span style="COLOR: #008080"> 5</span>
				<span style="COLOR: #000000">
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080"> 6</span>
				<span style="COLOR: #000000">
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> Light<br /></span>
				<span style="COLOR: #008080"> 7</span>
				<span style="COLOR: #000000">
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />    :</span>
				<span style="COLOR: #0000ff">public</span>
				<span style="COLOR: #000000"> Work</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">T</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">,<br /></span>
				<span style="COLOR: #008080"> 8</span>
				<span style="COLOR: #000000">
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />        OpMethod</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">Light</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080"> 9</span>
				<span style="COLOR: #000000">
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
				</span>
				<span style="COLOR: #008080">10</span>
				<span style="COLOR: #000000">
						<img id="Codehighlighter1_134_204_Open_Image" onclick="this.style.display='none'; Codehighlighter1_134_204_Open_Text.style.display='none'; Codehighlighter1_134_204_Closed_Image.style.display='inline'; Codehighlighter1_134_204_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_134_204_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_134_204_Closed_Text.style.display='none'; Codehighlighter1_134_204_Open_Image.style.display='inline'; Codehighlighter1_134_204_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />
				</span>
				<span id="Codehighlighter1_134_204_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_134_204_Open_Text">
						<span style="COLOR: #000000">{<br /></span>
						<span style="COLOR: #008080">11</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    T</span>
						<span style="COLOR: #000000">*</span>
						<span style="COLOR: #000000"> xxOp()<br /></span>
						<span style="COLOR: #008080">12</span>
						<span style="COLOR: #000000">
								<img id="Codehighlighter1_148_202_Open_Image" onclick="this.style.display='none'; Codehighlighter1_148_202_Open_Text.style.display='none'; Codehighlighter1_148_202_Closed_Image.style.display='inline'; Codehighlighter1_148_202_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_148_202_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_148_202_Closed_Text.style.display='none'; Codehighlighter1_148_202_Open_Image.style.display='inline'; Codehighlighter1_148_202_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_148_202_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_148_202_Open_Text">
								<span style="COLOR: #000000">{<br /></span>
								<span style="COLOR: #008080">13</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000">(Work(T).Status </span>
								<span style="COLOR: #000000">==</span>
								<span style="COLOR: #000000"> ACMODE)<br /></span>
								<span style="COLOR: #008080">14</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            OpMethod(</span>
								<span style="COLOR: #000000">*</span>
								<span style="COLOR: #0000ff">this</span>
								<span style="COLOR: #000000">);<br /></span>
								<span style="COLOR: #008080">15</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080">16</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
		</div>
		<p>
				<br />当你实例化一个Policy Based Class的时候，你还可以给出默认的实现，就像成员函数声明和定义时候给出的默认参数一样。</p>
		<p>回头来看一下多重继承和Templetes的特性：<br />多重继承：欠缺一种一成不变的可以套用的代码，在某种受控的情况下将继承的Class组合起来（多重继承只是将他们放在一起，然后提供一种访问方式）。Templetes：有这样的特性。<br />多重继承由于继承自多个Base Class，所以型别信息缺乏，而Templetes正式基于型别的。<br />多重继承容易扩张，而Templetes的特化不容易扩张。</p>
		<p>正是两项技术的互补，才使这样的技术实现成为可能。<br />Light对象继承多个policy class,使得特性得以在编译期间定值，从而实现Light Class功能的扩张。<br />而Templetes技术使得大部分Work以及OpMethod能够共享大部分基础代码，而对特定的版本实现定值。</p>
		<p>这样的好处就是，应用程序开发人员得以在应用设计时期，使用这些Class，选择适合自己的Policy组装自己的代码，从而使得程序大小得以精减，运行速率得以提高，而不必去包含整个又大又全的基础类库。</p>
		<p>以上只是一些学习的心得和体会，如果有不对的地方，希望大家多多指教。</p>
<img src ="http://www.cppblog.com/shenhuafeng/aggbug/12426.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/shenhuafeng/" target="_blank">CPP&&设计模式小屋</a> 2006-09-13 23:22 <a href="http://www.cppblog.com/shenhuafeng/archive/2006/09/13/12426.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Loki库的学习心得</title><link>http://www.cppblog.com/shenhuafeng/archive/2006/09/13/12402.html</link><dc:creator>CPP&amp;&amp;设计模式小屋</dc:creator><author>CPP&amp;&amp;设计模式小屋</author><pubDate>Wed, 13 Sep 2006 03:32:00 GMT</pubDate><guid>http://www.cppblog.com/shenhuafeng/archive/2006/09/13/12402.html</guid><wfw:comment>http://www.cppblog.com/shenhuafeng/comments/12402.html</wfw:comment><comments>http://www.cppblog.com/shenhuafeng/archive/2006/09/13/12402.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/shenhuafeng/comments/commentRss/12402.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/shenhuafeng/services/trackbacks/12402.html</trackback:ping><description><![CDATA[前段时间刚刚看完STL源代码解析,觉得受益非浅,不过总体来说STL的源代码还是比较浅显易懂的.最近学习Andrei Alexandrescu的Modern C++ Design,随后从网站上下载了Loki库的源代码,发觉还是有些难度的,准备将学习的点滴记录于此,每天写篇学习心得,也算是给自己一个学习的动力吧.<img src ="http://www.cppblog.com/shenhuafeng/aggbug/12402.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/shenhuafeng/" target="_blank">CPP&&设计模式小屋</a> 2006-09-13 11:32 <a href="http://www.cppblog.com/shenhuafeng/archive/2006/09/13/12402.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>