﻿<?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++博客-aslucky-文章分类-C++</title><link>http://www.cppblog.com/aslucky/category/7582.html</link><description>C++</description><language>zh-cn</language><lastBuildDate>Sat, 19 Jul 2008 16:04:57 GMT</lastBuildDate><pubDate>Sat, 19 Jul 2008 16:04:57 GMT</pubDate><ttl>60</ttl><item><title>Boost Study step1 介绍</title><link>http://www.cppblog.com/aslucky/articles/56637.html</link><dc:creator>aslucky</dc:creator><author>aslucky</author><pubDate>Sat, 19 Jul 2008 14:11:00 GMT</pubDate><guid>http://www.cppblog.com/aslucky/articles/56637.html</guid><wfw:comment>http://www.cppblog.com/aslucky/comments/56637.html</wfw:comment><comments>http://www.cppblog.com/aslucky/articles/56637.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/aslucky/comments/commentRss/56637.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/aslucky/services/trackbacks/56637.html</trackback:ping><description><![CDATA[认真学习boost库，以前用过一些，但是效率慢很多，所以就放弃了，但是我现在意识到开发效率比执行效率要重要。<br><br>Most Boost libraries are <strong>header-only</strong>: they consist <em>entirely of header files</em> containing templates and inline functions, and require no separately-compiled library binaries or special treatment when linking.<br><br>大部分的库都是以头文件的形式提供的不需要编译。<br><br>以下的库是需要分别单独编译的<br>
<p>The only Boost libraries that <em>must</em> be built separately are:</p>
<ul class=simple>
    <li><a class="reference external" href="http://www.boost.org/doc/libs/1_35_0/libs/filesystem/index.html">Boost.Filesystem</a>
    <li><a class="reference external" href="http://www.boost.org/doc/libs/1_35_0/libs/iostreams/index.html">Boost.IOStreams</a>
    <li><a class="reference external" href="http://www.boost.org/doc/libs/1_35_0/libs/program_options/index.html">Boost.ProgramOptions</a>
    <li><a class="reference external" href="http://www.boost.org/doc/libs/1_35_0/libs/python/doc/building.html">Boost.Python</a> (see the <a class="reference external" href="http://www.boost.org/doc/libs/1_35_0/libs/python/doc/building.html">Boost.Python build documentation</a> before building and installing it)
    <li><a class="reference external" href="http://www.boost.org/doc/libs/1_35_0/libs/regex/index.html">Boost.Regex</a>
    <li><a class="reference external" href="http://www.boost.org/doc/libs/1_35_0/libs/serialization/index.html">Boost.Serialization</a>
    <li><a class="reference external" href="http://www.boost.org/doc/libs/1_35_0/libs/signals/index.html">Boost.Signals</a>
    <li><a class="reference external" href="http://www.boost.org/doc/libs/1_35_0/doc/html/thread.html">Boost.Thread</a>
    <li><a class="reference external" href="http://www.boost.org/doc/libs/1_35_0/libs/wave/index.html">Boost.Wave</a> </li>
</ul>
<p>还有几个是可选编译的<br>A few libraries have optional separately-compiled binaries:</p>
<ul class=simple>
    <li><a class="reference external" href="http://www.boost.org/doc/libs/1_35_0/libs/date_time/index.html">Boost.DateTime</a> has a binary component that is only needed if you're using its <tt class="docutils literal"><span class=pre>to_string</span></tt>/<tt class="docutils literal"><span class=pre>from_string</span></tt> or serialization features, or if you're targeting Visual C++ 6.x or Borland.
    <li><a class="reference external" href="http://www.boost.org/doc/libs/1_35_0/libs/graph/index.html">Boost.Graph</a> also has a binary component that is only needed if you intend to <a class="reference external" href="http://www.boost.org/doc/libs/1_35_0/libs/graph/doc/read_graphviz.html">parse GraphViz files</a>.
    <li><a class="reference external" href="http://www.boost.org/doc/libs/1_35_0/libs/test/index.html">Boost.Test</a> can be used in &#8220;header-only&#8221; or &#8220;separately compiled&#8221; mode, although <strong>separate compilation is recommended for serious use</strong>. </li>
</ul>
<!-- Copyright David Abrahams 2006. Distributed under the Boost --><!-- Software License, Version 1.0. (See accompanying --><!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
<img src ="http://www.cppblog.com/aslucky/aggbug/56637.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/aslucky/" target="_blank">aslucky</a> 2008-07-19 22:11 <a href="http://www.cppblog.com/aslucky/articles/56637.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Constant Member Functions</title><link>http://www.cppblog.com/aslucky/articles/56454.html</link><dc:creator>aslucky</dc:creator><author>aslucky</author><pubDate>Thu, 17 Jul 2008 09:36:00 GMT</pubDate><guid>http://www.cppblog.com/aslucky/articles/56454.html</guid><wfw:comment>http://www.cppblog.com/aslucky/comments/56454.html</wfw:comment><comments>http://www.cppblog.com/aslucky/articles/56454.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/aslucky/comments/commentRss/56454.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/aslucky/services/trackbacks/56454.html</trackback:ping><description><![CDATA[<div class=introduction>
<p>Declaring a member function with the <strong>const</strong> keyword specifies that the function is a "read-only" function that does not modify the object for which it is called.</p>
<p>To declare a constant member function, place the <strong>const</strong> keyword after the closing parenthesis of the argument list. The <strong>const</strong> keyword is required in both the declaration and the definition. A constant member function cannot modify any data members or call any member functions that aren't constant.</p>
</div>
<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"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;constant_member_function.cpp</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;Date<br><img id=Codehighlighter1_43_230_Open_Image onclick="this.style.display='none'; Codehighlighter1_43_230_Open_Text.style.display='none'; Codehighlighter1_43_230_Closed_Image.style.display='inline'; Codehighlighter1_43_230_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_43_230_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_43_230_Closed_Text.style.display='none'; Codehighlighter1_43_230_Open_Image.style.display='inline'; Codehighlighter1_43_230_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_43_230_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_43_230_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">:<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;Date(&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;mn,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;dy,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;yr&nbsp;);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;getMonth()&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;A&nbsp;read-only&nbsp;function</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;setMonth(&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;mn&nbsp;);&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;A&nbsp;write&nbsp;function;&nbsp;can't&nbsp;be&nbsp;const</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000">:<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;month;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;Date::getMonth()&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"><br><img id=Codehighlighter1_261_314_Open_Image onclick="this.style.display='none'; Codehighlighter1_261_314_Open_Text.style.display='none'; Codehighlighter1_261_314_Closed_Image.style.display='inline'; Codehighlighter1_261_314_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_261_314_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_261_314_Closed_Text.style.display='none'; Codehighlighter1_261_314_Open_Image.style.display='inline'; Codehighlighter1_261_314_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_261_314_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_261_314_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;month;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;Doesn't&nbsp;modify&nbsp;anything</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top></span><span style="COLOR: #000000">}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;Date::setMonth(&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;mn&nbsp;)<br><img id=Codehighlighter1_346_396_Open_Image onclick="this.style.display='none'; Codehighlighter1_346_396_Open_Text.style.display='none'; Codehighlighter1_346_396_Closed_Image.style.display='inline'; Codehighlighter1_346_396_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_346_396_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_346_396_Closed_Text.style.display='none'; Codehighlighter1_346_396_Open_Image.style.display='inline'; Codehighlighter1_346_396_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_346_396_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_346_396_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;month&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;mn;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;Modifies&nbsp;data&nbsp;member</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top></span><span style="COLOR: #000000">}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main()<br><img id=Codehighlighter1_409_596_Open_Image onclick="this.style.display='none'; Codehighlighter1_409_596_Open_Text.style.display='none'; Codehighlighter1_409_596_Closed_Image.style.display='inline'; Codehighlighter1_409_596_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_409_596_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_409_596_Closed_Text.style.display='none'; Codehighlighter1_409_596_Open_Image.style.display='inline'; Codehighlighter1_409_596_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_409_596_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_409_596_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;Date&nbsp;MyDate(&nbsp;</span><span style="COLOR: #000000">7</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #000000">1998</span><span style="COLOR: #000000">&nbsp;);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Date&nbsp;BirthDate(&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #000000">18</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #000000">1953</span><span style="COLOR: #000000">&nbsp;);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;MyDate.setMonth(&nbsp;</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">&nbsp;);&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;Okay</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;BirthDate.getMonth();&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;Okay</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;BirthDate.setMonth(&nbsp;</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">&nbsp;);&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;C2662&nbsp;Error</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top></span><span style="COLOR: #000000">}</span></span></div>
<img src ="http://www.cppblog.com/aslucky/aggbug/56454.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/aslucky/" target="_blank">aslucky</a> 2008-07-17 17:36 <a href="http://www.cppblog.com/aslucky/articles/56454.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>