<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Imagine there's no heaven</title>
	<atom:link href="http://blog.donews.com/bubble/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.donews.com/bubble</link>
	<description>漫步人生路</description>
	<lastBuildDate>Wed, 17 May 2006 03:45:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>(转)Making AJAX development easier</title>
		<link>http://blog.donews.com/bubble/archive/2006/05/17/872920.aspx</link>
		<comments>http://blog.donews.com/bubble/archive/2006/05/17/872920.aspx#comments</comments>
		<pubDate>Wed, 17 May 2006 03:45:00 +0000</pubDate>
		<dc:creator>bubble</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://blog.donews.com/bubble/archive/2006/05/17/872920.aspx</guid>
		<description><![CDATA[很酷的技术，先收藏，有机会了学习学习]]></description>
			<content:encoded><![CDATA[<h3 id="item-title">转自Official Google Blog</h3>
<hr style="width: 100%; height: 2px;"/><a target="_blank" class="item-title-link" href="http://googleblog.blogspot.com/2006/05/making-ajax-development-easier.html"><ins class="title">Making AJAX development easier</ins></a><br />
<h3 id="item-title">
</h3>
<p class="item-attribution">
<span class="author-parent"><ins class="author">A Googler</ins>&nbsp;</span><span class="date-parent"><ins class="date">May 16, 2006</ins></span><br />
<span class="launch-original-parent"><br />
&nbsp;-&nbsp;<br />
<a target="_blank" class="launch-original" href="http://googleblog.blogspot.com/2006/05/making-ajax-development-easier.html"><br />
Show original item<br />
</a><br />
</span>
</p>
<div class="item-body-container">
<div id="">
<ins class="item-body">
<div>
<div>
<span>Posted by Bret Taylor, Product Manager</span><br />
<br/><br />
<br/><br />
<a href="http://en.wikipedia.org/wiki/AJAX" target="_new">AJAX</a> has<br />
the power to make your site more compelling and more dynamic, but AJAX<br />
development is often complicated, with much of the development time<br />
spent working around browser quirks and the fragility of AJAX<br />
components. Trust us, we know&#8211;the development of our own AJAX apps,<br />
like Google Maps and Google Calendar, caused us no small amount of<br />
AJAX-induced frustration. <br/><br />
<br/>That&#8217;s why we&#8217;re bringing you Google Web Toolkit. GWT is a new<br />
publicly available software development tool that makes creating AJAX<br />
applications much easier. With GWT, you can develop and debug your own<br />
AJAX applications in Java code using the Java development tools of your<br />
choice. When you deploy your application to production, the GWT<br />
compiler simply translates your Java application to browser-compliant<br />
JavaScript and HTML. <br/><br />
<br/>Check it out over on <a href="http://code.google.com/webtoolkit/" target="_new">Google Code</a>.</div>
</div>
<p></ins>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.donews.com/bubble/archive/2006/05/17/872920.aspx/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>千呼万唤始出来&#8211; google calendar</title>
		<link>http://blog.donews.com/bubble/archive/2006/04/13/826235.aspx</link>
		<comments>http://blog.donews.com/bubble/archive/2006/04/13/826235.aspx#comments</comments>
		<pubDate>Thu, 13 Apr 2006 06:36:00 +0000</pubDate>
		<dc:creator>bubble</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://blog.donews.com/bubble/archive/2006/04/13/826235.aspx</guid>
		<description><![CDATA[google calendars]]></description>
			<content:encoded><![CDATA[<p>下面是地址，使用以前的google帐号就可有登陆<br/>http://calendar.google.com/<br/><br/>期盼已久，果然是相当不错<br type="_moz"/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.donews.com/bubble/archive/2006/04/13/826235.aspx/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>转：A Brief Look at C++0x</title>
		<link>http://blog.donews.com/bubble/archive/2006/04/06/815446.aspx</link>
		<comments>http://blog.donews.com/bubble/archive/2006/04/06/815446.aspx#comments</comments>
		<pubDate>Thu, 06 Apr 2006 07:29:00 +0000</pubDate>
		<dc:creator>bubble</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://blog.donews.com/bubble/archive/2006/04/06/815446.aspx</guid>
		<description><![CDATA[未来的C++是什么样的？]]></description>
			<content:encoded><![CDATA[<div class="summary">
<div class="summarytitle">Summary</div>
<p>Bjarne offers a sneak peek at the next version of standard C++ (&quot;C++0x&quot;) which<br />
should be complete by 2009.The work on C++0x has entered a decisive phase. The ISO C++ committee aims for<br />
C++0x to become C++09. It follows that the standard must be complete for ratification<br />
by the ISO member nations in 2008. The set of facilities offered will be chosen from<br />
those currently being considered. To finish in time, the committee has stopped looking<br />
for new proposals and concentrates on the ones already being considered.
</p></div>
<p>
This paper briefly outlines the guiding principles of the work on C++0x, presents a few<br />
examples of likely language extensions, and lists some proposed new standard libraries.
</p>
<p>
[Note: This paper was first presented to the &quot;Modern C++ Design &amp; Programming&quot; conference<br />
in Shanghai, November 18, 2005]</p>
<h1>Guiding Principles</h1>
<p>C++ is a general-purpose programming language with a bias towards systems<br />
programming that:</p>
<ul>
<li>is a better C
</li>
<li>supports data abstraction
</li>
<li>supports object-oriented programming
</li>
<li>supports generic programming
</li>
</ul>
<p>
By &quot;systems programming&quot;, I mean programming the kind of tasks traditionally<br />
associated with the operating system and fundamental tools. This includes the operating<br />
system kernel, device drivers, system utilities, networking, word processing tools,<br />
compilers, some kinds of graphics and GUI, database systems, games engines,<br />
CAD/CAM, telecommunications systems, etc. This kind of work is strongly represented<br />
among current C++ users. For example, see my &quot;applications&quot; page:<br />
<a href="http://www.research.att.com/%7Ebs/applications.html">http://www.research.att.com/~bs/applications.html</a>.
</p>
<p>
The aim of C++0x is for that characterization above to remain true. It is not an aim to eliminate<br />
one of those styles (or &quot;paradigms&quot;; e.g. to make C++ less compatible with C) or to add a<br />
radically new paradigm. The most effective styles of programming use a combination of<br />
these techniques. Using these techniques in concert is often called &quot;multi-paradigm programming,&quot; so we<br />
can say that we want to improve C++ as a multi-paradigm programming language.
</p>
<p>
The high level aims for the language part of C++0x are to:
</p>
<ul>
<li>Make C++ a better language for systems programming and library building</p>
<ul>
<li>Rather than providing specialized facilities for a particular sub-community (e.g.,<br />
numeric computation or Windows-style application development)
</li>
</ul>
</li>
<li>Make C++ easier to teach and learn
<ul>
<li>Through increased uniformity, stronger guarantees, and facilities supportive of<br />
novices
</li>
</ul>
</li>
</ul>
<p>
In other words, C++0x should be better than C++98 where C++98 is already<br />
strong&mdash;and maybe in a few more areas that are natural generalizations of what<br />
C++98 supports. When it comes to supporting specialized application areas, such as<br />
numeric computation, Windows-style application development, and embedded systems<br />
programming, C++0x will rely on libraries. The efficiency of the basic language features<br />
(such as, stack-allocated objects and pointers) plus the generality and flexibility of<br />
its abstraction mechanisms (such as classes and templates) make the use of libraries<br />
attractive in an incredibly broad set of application areas and reduce the need for new<br />
language features.
</p>
<p>
We cannot make the language simpler to teach and learn by removing features. Stability<br />
and compatibility are major concerns, so eliminating anything of importance (in any way)<br />
is not an option (and eliminating something of no importance would not be a help). This<br />
leaves us with the options of generalizing rules and adding easier-to-use features. We aim<br />
at both, but the latter is easier. For example, better library facilities, such as containers<br />
and algorithms, save users from some of the problems associated with lower-level<br />
facilities like arrays and pointers. Language facilities that simplify the definition and<br />
use of libraries (such as concepts and generalized initializer lists&mdash;see below) will therefore<br />
contribute to the ease of use of C++0x.
</p>
<p>Some people object: &quot;Don&#8217;t dumb-down C++ for novices&mdash;there are<br />
languages enough for those&quot;, or &quot;The sooner novices become experts the<br />
better!&quot; These people have a point, but there will always be more novices<br />
than experts.  Many C++ users quite reasonably don&#8217;t want to become C++<br />
experts&mdash;they are experts in their own fields (e.g., physicists,<br />
graphics specialists, or hardware engineers) who use C++.  In my opinion,<br />
C++ has become too &quot;expert friendly&quot; and it will cost us little to provide<br />
much better support for &quot;novices&quot;. It will cost us nothing in terms of<br />
performance (the zero-overhead principle still holds), in flexibility (we<br />
don&#8217;t propose to prohibit anything), or in terseness of code.  On the<br />
contrary, we aim to simplify expression of ideas.  Finally, C++ is so<br />
large, is used in so many application areas, and there are so many useful<br />
C++ design techniques, that we are all &quot;novices&quot; much of the time.  </p>
<p>
The C++0x improvements should be done in such a way that the resulting language is<br />
easier to learn and use. Among the rules of thumb for the committee are:
</p>
<ul>
<li>Provide stability and compatibility (with C++98, and, if possible, with C)
</li>
<li>Prefer standard library facilities to language extensions
</li>
<li>Make only changes that change the way people think
</li>
<li>Prefer generality to specialization
</li>
<li>Support both experts and novices
</li>
<li>Increase type safety (by providing safe alternatives to currently unsafe facilities)
</li>
<li>Improve performance and ability to work directly with hardware
</li>
<li>Fit into the real world
</li>
</ul>
<p>Naturally, applying these ideals and rules is an art rather than a science and people can<br />
(and do) disagree on what is a natural development of C++ and what would be a new<br />
paradigm. C++0x will most likely support optional garbage collection and it will support<br />
concurrency in the form of a machine model plus standard library facilities supporting<br />
threads (and maybe more). Some would consider that radical, but I don&rsquo;t; people have<br />
used garbage collection with C++ for years (where that makes sense) and just about<br />
everybody uses threads sometime. In these cases, the issue is simply to standardize<br />
current practice.</p>
<p>
We try to focus on extensions that &quot;change the way people think&quot; because that way we<br />
gain the greatest benefits for our efforts. Every change has a cost in terms of<br />
implementation, learning, etc., and the cost of a change does not always directly relate to its<br />
benefits. The major advances/benefits do not come from improving the way a<br />
programmer writes an individual line of code, but from improving the way a programmer<br />
solves problems and organizes programs. Object-oriented programming and generic<br />
programming have changed the way many people think&mdash;and that was the purpose<br />
of the C++ language facilities supporting those styles. Thus, the best use of our time as<br />
language and library designers is to work on facilities and techniques that help change the<br />
way people think.
</p>
<p>
Please note the last rule, &quot;Fit into the real world&quot;. As usual for C++, the aim is not to<br />
create the most beautiful language&mdash;though we all prefer elegance when we can<br />
get it&mdash;but to provide the most useful language. This implies that compatibility,<br />
performance, ease of learning, and interoperability with other systems and languages are<br />
serious interrelated concerns.</p>
<h1>Language Features</h1>
<p>Let&rsquo;s see how code using new C++0x features might look:</p>
<pre class="indent">template&lt;class T&gt; using Vec = vector&lt;T,My_alloc&lt;T&gt;&gt;;<br/>Vec&lt;double&gt; v = { 2.3, 1.2, 6.7, 4.5  };<br/>sort(v);<br/>for(auto p = v.begin(); p!=v.end(); ++p)<br/>    cout &lt;&lt; *p &lt;&lt; endl;<br/></pre>
<p>Each line except the last is illegal in C++98, and in C++98 we&rsquo;d have to write more (error-prone) code<br />
to get the work done. I hope you can guess the meaning of this code without<br />
explanation, but let&rsquo;s look each line individually.</p>
<pre class="indent">template&lt;class T&gt; using Vec = vector&lt;T,My_alloc&lt;T&gt;&gt;;<br/></pre>
<p>Here, we define <code>Vec&lt;T&gt;</code> to be an alias of<br />
<code>vector&lt;T,My_alloc&lt;T&gt;&gt;</code>. That is, we define a vector called<br />
<code>Vec</code> that works exactly like <code>vector</code> except that it uses my<br />
allocator (<code>My_alloc</code>) rather than the default allocator. The ability to<br />
define such aliases and to bind some but not all parameters of a template has been<br />
missing from C++. It has traditionally been referred to as a &quot;template typedefs&quot; because<br />
<code>typedef</code> is what we typically use for defining type aliases, but for<br />
technical reasons, we preferred <code>using</code>. One advantage of this syntax is<br />
that it introduces the name being defined where it is easy for the human reader to spot.<br />
Note also another detail. I didn&rsquo;t write</p>
<pre class="indent">template&lt;class T&gt; using Vec = vector&lt; T,My_alloc&lt;T&gt; &gt;;<br/></pre>
<p>It will no longer be necessary to add that space between the terminating &gt;&#8217;s. These two<br />
extensions have already been accepted in principle.</p>
<p>
Next we define and initialize a <code>Vec</code>:
</p>
<pre class="indent">Vec&lt;double&gt; v = { 2.3, 1.2, 6.7, 4.5  };<br/></pre>
<p>Initializing a user-defined container<br />
(<code>vector&lt;double,My_allocator&lt;double&gt;&gt;</code>) with an<br />
initializer list is new. In C++98, we can only use such initializer lists for aggregates<br />
(arrays and classic <code>struct</code>s). Exactly how this extension will be achieved is still<br />
being discussed, but the solution will most likely involve a new kind of<br />
constructor&mdash;a &quot;sequence constructor&quot;. Allowing the above implies that<br />
C++ better meets one of its fundamental design criteria: support user-defined and built-in<br />
types equally well. In C++98 arrays have a notational advantage over<br />
<code>vector</code>s. In C++0x, that will no longer be the case.<br/><br/></p>
<p>Next, we sort the vector:</p>
<pre class="indent">sort(v); <br/></pre>
<p>To do that within the framework of the STL we must overload <code>sort</code> for<br />
containers and for iterators. For example:</p>
<pre class="indent">template&lt;Container C&gt; // sort container using &lt;<br/>    void sort(C&amp; c);<br/>      <br/>template&lt;Container C, Predicate Cmp&gt; // sort container using Cmp<br/>    where Can_call_with&lt;Cmp,typename C::value_type&gt;<br/>    void sort(C&amp; c, Cmp less);<br/>      <br/>template&lt;Random_access_iterator Ran&gt; // sort sequence using &lt;<br/>    void sort(Ran first, Ran last);<br/>      <br/>template&lt;Random_access_iterator Ran, Predicate Cmp&gt; // sort sequence using Cmp <br/>    where Can_call_with&lt;Cmp,typename Ran::value_type&gt;<br/>    void sort(Ran first, Ran last, Cmp less);<br/></pre>
<p>This illustrates the most significant proposed C++0x language extension that is likely to be accepted: <em>concepts</em>.<br />
Basically, a concept is the type of a type; it specifies the <em>properties</em> required of a type. In<br />
this case, the concept <code>Container</code> is used to specify that the two first<br />
versions of <code>sort</code> need an argument that meets the standard library<br />
container requirements. The <code>where</code>-clauses are used to specify the<br />
required relationship between the template arguments: that the predicates can be applied<br />
to the containers&#8217; element types. Given concepts we can provide far better error<br />
messages than is currently possible and distinguish between templates taking the same<br />
number of arguments, such as </p>
<pre class="indent">sort(v, Case_insensitive_less());   // container and predicate<br/></pre>
<p>and</p>
<pre class="indent">sort(v.begin(), v.end());           // two random access iterators<br/></pre>
<p>The difficulty in the design of &ldquo;concept&rdquo; is to maintain the flexibility<br />
of templates so that we don&rsquo;t require template arguments to fit into class<br />
hierarchies or require all operations to be accessed through virtual<br />
functions (as for Java and C# generics).  In &ldquo;generics&rdquo;, an argument must<br />
be of a class derived from an interface (the C++ equivalent to &ldquo;interface&rdquo;<br />
is &ldquo;abstract class&rdquo;) specified in the definition of the generic.  That<br />
means that all generic argument types must fit into a hierarchy.  That<br />
imposes unnecessary constraints on designs requires unreasonable foresight<br />
on the part of developers.  For example, if you write a generic and I<br />
define a class, people can&#8217;t use my class as an argument to your generic<br />
unless I knew about the interface you specified and had derived my class<br />
from it.  That&#8217;s rigid.  </p>
<p>
There are workarounds, of course, but they complicate code. Another problem is that you<br />
cannot use built-in types directly with generics, because built-in types, such as<br />
<code>int</code>, are not classes and don&#8217;t have the functions required by interfaces<br />
specified by a generic&mdash;you then have to make wrapper classes for holding built-in<br />
types and access elements indirectly through pointers. Also, the typical operation on a<br />
generic is implemented as a virtual function call. That can be very expensive (compared<br />
to just using a simple built-in operation, such as + or &lt;). Implemented that way,<br />
generics are simply syntactic sugar for abstract classes.
</p>
<p>Given &quot;concepts&quot;, templates will retain their flexibility and performance.<br />
There is still much work left before the committee can accept a specific<br />
and detailed concept design.  However, concepts are a most likely<br />
extension because they promise significantly better type checking, much<br />
better error messages, and greater expressive power.  That should lead to<br />
significantly better library interfaces, starting with the current<br />
standard containers, iterators, and algorithms.</p>
<p>Finally, consider the last line that outputs the elements of our vector:
</p>
<pre class="indent">for (auto p = v.begin(); p!=v.end(); ++p)<br/>    cout &lt;&lt; *p &lt;&lt; endl; <br/></pre>
<p>The difference from C++98 here is that we don&rsquo;t have to mention the type of the iterator:<br />
<code>auto</code> means &ldquo;deduce the type of the declared variable from the<br />
initializer&rdquo;. Such uses of <code>auto</code> are far less verbose and also less<br />
error-prone than current alternatives, such as:</p>
<pre class="indent">for (vector&lt; double, My_alloc&lt;double&gt; &gt;::const_iterator p = v.begin(); p!=v.end(); ++p)<br/>    cout &lt;&lt; *p &lt;&lt; endl; <br/></pre>
<p>The new language features mentioned here are all aimed at simplifying generic<br />
programming. The reason is that generic programming has become so popular that it is<br />
seriously strains the language facilities. Many &ldquo;modern&rdquo; generic programming techniques<br />
border on &ldquo;write only&rdquo; techniques and threaten to isolate its users. To make generic<br />
programming mainstream, as object-oriented programming was made mainstream, we<br />
must make template code easier to read, write, and use. Many current uses are too clever<br />
for their own good. Good code is simple (relative to what it is trying to do), easy to<br />
check, and easy to optimize (i.e., efficient). This implies that a wide range of simple ideas<br />
can be expressed simply in C++0x and that the resulting code is uncompromisingly<br />
efficient. The former is not the case in C++98&mdash;at least not for a sufficiently large<br />
range of techniques relying on templates.  Better type checking and more extensive use of<br />
type information to shorten code will make code shorter and clearer, and easier to maintain,<br />
as well as more likely to be correct.</p>
<h1>Library Facilities</h1>
<p>Ideally, we&rsquo;d leave the C++ language mostly unchanged and focus on adding standard<br />
libraries. However, libraries that are sufficiently general to be standard are not easy to<br />
design and the standards committee is&mdash;as usual&mdash;short of resources. We<br />
are a relatively small group of volunteers and all have &ldquo;day jobs&rdquo;. This puts unfortunate<br />
limits on how adventurous we can be with new libraries. On the other hand, the<br />
committee started early and a technical report on libraries (&quot;The Library TR&quot;) was recently approved by vote. It<br />
provides several facilities that are directly useful to programmers: </p>
<ul>
<li>Hash Tables
</li>
<li>Regular Expressions
</li>
<li>General Purpose Smart Pointers
</li>
<li>Extensible Random Number Facility
</li>
<li>Mathematical Special Functions
</li>
</ul>
<p>I particularly appreciate having standard versions of regular expression matching and<br />
hash tables (called <code>unordered_map</code>s) available. In<br />
addition, the Library TR provides extensive facilities for builders of generic libraries<br />
building on the STL:</p>
<ul>
<li>Polymorphic Function Object Wrapper
</li>
<li>Tuple Types
</li>
<li>Type Traits
</li>
<li>Enhanced Member Pointer Adaptor
</li>
<li>Reference Wrapper
</li>
<li>Uniform Method for Computing Function Object Return Types
</li>
<li>Enhanced Binder
</li>
</ul>
<p>This is not the place to go into details about these libraries or into the further facilities<br />
that the committee would like to provide. If you are interested, I suggest you look at the<br />
proposals on the WG21 site (see &ldquo;information sources&rdquo; below), the libraries &ldquo;wish list&rdquo;<br />
(on my home pages), and the BOOST libraries (www.boost.org). I personally would like<br />
to see more libraries that are immediately useful to applications builders, such as Beman<br />
Dawes&rsquo; library for manipulating files and directories (currently a BOOST library) and a<br />
socket library.</p>
<p>
The list of proposals is still quite modest and not anywhere as<br />
ambitious as I&rsquo;d like. However, more proposals from the committee&#8217;s<br />
large backlog of suggestions are being considered and more libraries<br />
will appear either as part of the C++0x standard itself or as further<br />
committee technical reports. Unfortunately, lack of resources (time,<br />
money, skills, people, etc.) will continue to limit progress in this<br />
direction. Sadly, I cannot offer hope for the most frequently wished<br />
for new standard library: a standard GUI library. A GUI library is<br />
simply too large a task for the volunteers of the C++ standards<br />
committee to handle and too difficult a task given the many<br />
(non-standard but huge, useful, and supported) GUI libraries available.<br />
Please notice that even though they are not standard, the major C++<br />
GUIs have more users than most programming languages and are often<br />
better supported.
</p>
<p>
In addition to these general-purpose libraries, the committee presented a library interface<br />
to the most basic level of hardware in its &ldquo;Performance TR&rdquo;. That TR is primarily aimed<br />
to help embedded systems programmers and to disprove myths about poor performance<br />
of C++ code and about C++ being unsuitable for low-level tasks. </p>
<h1>Putting It All Together</h1>
<p>&ldquo;Drawing all shapes in an array&rdquo; is a classical example of object-oriented programming<br />
(going back to the early Simula days). Using generic programming, we can generalize<br />
that to drawing each element of any container holding (pointers to) shapes:</p>
<pre class="indent">template&lt;Container C&gt;<br/>void draw_all(C&amp; c)	<br/>where Usable_as&lt;typename C::value_type,Shape*&gt;<br/>{<br/>    for_each(c, mem_fun(&amp;Shape::draw));<br/>}<br/></pre>
<p>In C++0x, we hope to have <code>Container</code> as a standard concept and <code>Usable_as</code><br />
as a standard predicate. The<br />
<code>for_each</code> algorithm is already in C++98, but the version that takes a<br />
container (rather than a pair of iterators) will have to wait for concepts in C++0x. The<br />
<code>where</code>-clause is a mechanism through which an algorithm can express<br />
requirements on its arguments. Here, <code>draw_all()</code> requires (obviously) that<br />
the elements of the container must be usable as (implicitly convertible to)<br />
<code>Shape*</code>. In this case, the where-clause gives us a degree of<br />
flexibility/generality not offered by simply requiring a container of<br />
<code>Shape*</code>&#8217;s. In addition to any container of <code>Shape*</code>&#8217;s, we can<br />
use any container with elements that can be used as <code>Shape*</code>&#8217;s, such as a<br />
<code>list&lt;shared_ptr&lt;Shape*&gt;&gt; </code> (where<br />
<code>shared_ptr</code> is a likely C++0x standard library class) or a container of<br />
pointers to a class derived from <code>Shape*</code>, such as<br />
<code>deque&lt;Circle*&gt;</code>.</p>
<p>
Assuming that we have points <code>p1</code>, <code>p2</code>, and <code>p3</code>, we can test<br />
<code>draw_all()</code> like this
</p>
<pre class="indent">vector&lt;Shape*&gt; v = {<br/>    new Circle(p1,20),<br/>    new Triangle(p1,p2,p3),<br/>    new Rectangle(p3,30,20)<br/>};<br/><br/>draw_all(v);<br/><br/>list&lt;shared_ptr&lt;Shape*&gt;&gt; v2 = {<br/>    new Circle(p1,20),<br/>    new Triangle(p1,p2,p3),<br/>    new Rectangle(p3,30,20)<br/>};<br/><br/>draw_all(v2);<br/></pre>
<p>The &quot;draw all shapes&quot; example is important because when you can do that well, you can<br />
do much of what&rsquo;s key to object-oriented programming. As written here, the example<br />
demonstrates the power of multi-paradigm programming by also employing generic<br />
programming (concepts and templates), conventional programming (e.g. the<br />
free-standing standard-library function <code>mem_fun()</code>), and simple data<br />
abstraction (the function object returned by <code>mem_fun()</code>). Thus, this<br />
simple example opens the door to a host of elegant and efficient programming<br />
techniques.</p>
<p>
I hope that after looking a bit at this example, your reaction will be &quot;How simple!&quot; rather<br />
than &quot;How clever! How advanced!&quot;  In my opinion, many people are trying too hard to<br />
be clever and advanced. The real aim of design and programming is to produce the<br />
simplest solution that does the job and express it in the clearest possible way. The aim of<br />
the C++0x design is to better support such simple solutions.</p>
<p><img width="15" height="15" align="top" src="http://www.artima.com/images/ig.gif" alt=""/>
</p>
<h1>Information Sources</h1>
<p>My web pages (<a href="http://www.research.att.com/%7Ebs">http://www.research.att.com/~bs</a>)<br />
contain much useful information.<br />
There you will find information about my own work (books, articles, interviews, FAQs, etc.) and<br />
links to sources that I find most helpful, such as a list of interesting C++ applications, a list of<br />
C++ compilers, and links to useful libraries (e.g., BOOST). In connection with C++0x,<br />
you can find:</p>
<ul>
<li>&quot;Wish lists&quot; for language features and library facilities
</li>
<li>The Standard: IOC/IEC 14882&mdash;International Standard for Information<br />
Systems&mdash;Programming Language C++
</li>
<li>The Performance TR:  ISO/IEC PDTR 18015&mdash;Technical Report on C++<br />
Performance.
</li>
<li>The Library TR: JTC1.22.19768 ISO/IEC TR 19768&mdash;C++ Library<br />
Extensions.
</li>
<li>A link to the WG21 (ISO C++ Standards Committee) site, where you can find all the proposals being considered
</li>
<li>A page with some of my proposals (including &quot;concepts&quot;) to the committee. (Please<br />
remember that not all proposals are accepted and that essentially all proposals that are<br />
accepted incorporate major changes and improvements before acceptance.)
</li>
</ul>
<h1>Acknowledgements</h1>
<p>Thanks to Rong Yao (&quot;Royal&quot;) who encouraged me to clarify many points. Also thanks<br />
to Nicholas Stroustrup, Bjorn Karlsson, and students from my 689 class for<br />
their helpful comments.</p>
<p><br clear="all"/></p>
<h1>About the Author</h1>
<p><a href="http://research.att.com/%7Ebs">Bjarne Stroustrup</a> is the designer and original implementor of the C++<br />
Programming Language. He is currently the College of Engineering Endowed Chair<br />
in Computer Science at Texas A&amp;M University.<br />
He formerly worked as the head of AT&amp;T Lab&#8217;s Large-scale Programming Research<br />
department, from its creation until late 2002.<br type="_moz"/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.donews.com/bubble/archive/2006/04/06/815446.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用latex时遇到的几个错误</title>
		<link>http://blog.donews.com/bubble/archive/2006/03/30/802930.aspx</link>
		<comments>http://blog.donews.com/bubble/archive/2006/03/30/802930.aspx#comments</comments>
		<pubDate>Thu, 30 Mar 2006 08:51:00 +0000</pubDate>
		<dc:creator>bubble</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://blog.donews.com/bubble/archive/2006/03/30/802930.aspx</guid>
		<description><![CDATA[使用pdflatex时的几个错误]]></description>
			<content:encoded><![CDATA[<p>最近在写项目的文档，直接是用latex写的，很方便可以生成漂亮的英文文档。但是当我加入一些图片时，却发生了一些小错误。<br/><br/>错误1：加入用metapost生成的图片时，出现下面的错误提示：<br/>! LaTeX Error: Unknown graphics extension: .1.<br/><br/>后来才发现是使用了pdflatex来生成文档时，而产生的错误。<br/>解决方法：加一句&nbsp; \DeclareGraphicsRule{*}{mps}{*}{}<br/>见<a href="http://learn.tsinghua.edu.cn:8080/2001315450/wiki/MpPdflatex.html">wangyin的页面</a><br/><br/>错误2：另外有些图片是用openoffice画的，其输出的是后缀为eps的文件。再直接加入时有下面的错误：<br/>&lt;use ./figures/stack.png&gt; [MP to PDF] (./figures/packet.eps<br/>! TeX capacity exceeded, sorry [save size=5000].<br/>\dohandleMPpathA &#8230;he \nofMParguments \endcsname<br/><br/>后来发现也是图片和pdflatex一起用时的错误。可以讲eps文件转换为pdf图片<br/>更多的解决方法见<a href="http://www.2pi.info/latex/Includingeps.html">下列页面</a><br/><br/>关于pdflatex，可见<a href="http://en.wikipedia.org/wiki/Pdflatex">wikipedia</a>。（竟然发现wikipedia可以用了？奇怪的是过了一会又不能用了）<br/>tex处理过tex文件后生成dvi文件，然后通过dvipdf转换成pdf文件<br/>pdflatex直接处理tex文件，输出pdf文件<br/>pdflatex使用jpg，png能图片格式，不能加入eps文件<br/><br/>wikipedia怎么突然能用了，然后又闪电般的不能用了？<br/><img width="500" height="358" src="/images/blog_donews_com/bubble/wikipedia.jpg" alt=""/><br type="_moz"/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.donews.com/bubble/archive/2006/03/30/802930.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Page Creator的邀请</title>
		<link>http://blog.donews.com/bubble/archive/2006/03/22/781091.aspx</link>
		<comments>http://blog.donews.com/bubble/archive/2006/03/22/781091.aspx#comments</comments>
		<pubDate>Wed, 22 Mar 2006 10:37:00 +0000</pubDate>
		<dc:creator>bubble</dc:creator>
				<category><![CDATA[其他]]></category>

		<guid isPermaLink="false">http://blog.donews.com/bubble/archive/2006/03/22/781091.aspx</guid>
		<description><![CDATA[google page creator]]></description>
			<content:encoded><![CDATA[<p>早上，发现邮箱里有封信是google发来的。邀请我使用page creator。<br/><br/><img src="file:////home/seaman/googlepagecreator.jpeg" alt=""/><img width="500" height="252" src="http://blog.donews.com/images/blog_donews_com/bubble/79854/r_googlepagecreator.jpeg" alt=""/><br/><br/>发现这个服务还不错。这是<a href="http://straggler.fan.googlepages.com/">我的页面</a>。但是，好像lianliming很早就有这个邀请了吧，为什么我的要慢这么多呢，上次的那个gtalk就是我晚一些才收到了google的邀请。<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.donews.com/bubble/archive/2006/03/22/781091.aspx/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>这个blog以后作为技术用</title>
		<link>http://blog.donews.com/bubble/archive/2006/03/20/777253.aspx</link>
		<comments>http://blog.donews.com/bubble/archive/2006/03/20/777253.aspx#comments</comments>
		<pubDate>Mon, 20 Mar 2006 07:04:00 +0000</pubDate>
		<dc:creator>bubble</dc:creator>
				<category><![CDATA[观点]]></category>

		<guid isPermaLink="false">http://blog.donews.com/bubble/archive/2006/03/20/777253.aspx</guid>
		<description><![CDATA[对自己的网络使用方式进行重构。。。]]></description>
			<content:encoded><![CDATA[<p>最近看到<a href="http://http://spaces.msn.com/dawnlinux/blog/cns!A00E94DBF87E3089!250.entry">朋友的文章</a>，谈到了要记住朋友的生日。仔细想想，我也是相当的惭愧，自己这些年来忙来忙去，也常常忘记朋友的生日，还有好多的朋友的渐少联系了。而这真是因为工作有那么忙？自己有blog也是想写就写，懒了也就不写了。实际上现在的通讯和交流方式是很多的，完全是可以做的更好的。<br/>所以，对自己的网络使用方式进行重构。经常写点自己的情况，多和朋友们联系和沟通。<br/>这个blog以后作为技术blog，讨论技术话题。在msn<a href="http://spaces.msn.com/fantasia-yang">新建了blog</a>，更多的是用来和朋友交流。<br/>我的邮箱是gmail的那个，欢迎朋友来信联系。<br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.donews.com/bubble/archive/2006/03/20/777253.aspx/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>一天</title>
		<link>http://blog.donews.com/bubble/archive/2006/03/13/766536.aspx</link>
		<comments>http://blog.donews.com/bubble/archive/2006/03/13/766536.aspx#comments</comments>
		<pubDate>Mon, 13 Mar 2006 13:15:00 +0000</pubDate>
		<dc:creator>bubble</dc:creator>
				<category><![CDATA[琐事]]></category>

		<guid isPermaLink="false">http://blog.donews.com/bubble/archive/2006/03/13/766536.aspx</guid>
		<description><![CDATA[平凡的一天...]]></description>
			<content:encoded><![CDATA[<p>仔细想了想，今天还是发生了好多的事的，就记下来吧。<br/><br/>先是因为要给zyn复印论文，今天就偷懒没有去单位。所以早上也就可以小小的有个懒觉。<br/><br/>在还没有睡醒时，yj给我发短信说她的那个工作泡汤了，好多留洋的人和她竞争，找个好工作是不容易阿。<br/><br/>先去图书馆问了复印论文的一些要求，所是要找那个论文的作者或者其导师的同意，我得在下午zyn来之前把这个搞定了，然后下午她来就直接可以印论文了。<br/><br/>还好我要给zyn印的两个论文的作者都是一个老师的学生，但我不知道那个老师的办公室在那里。就先回世宁放下书包，然后查到那个老师在流体力学国家实验室那里。<br/><br/>然后，我就凭着自己的印象和问别人，找到那个学院的院办。那个楼很旧，里面人不是很多，有一些人在开会。最后问到了教务办公室，里面一个中年女人，我都看不出她脸上抹了几层，:P。看她手头好像有什么事，对我也爱理不理。她告诉我到对面的国家重点实验室去找那个老师。<br/><br/>从那个楼出来，我就找那个楼的入口，对面有个mm好像再等人，她看到我，走过来问我505教研室在那里，我当然是不知道了。但是很奇怪，周围的楼好像没有超过5层的。怎么看她长得像上回lxx带去打羽毛球的那个很厉害的那个mm呢？<br/><br/>我进了那个重点实验室的大楼，里面有点冷清，好多巨粗的管子，好像是实验用的，我逮着一个人就问，yxg老师在那个教研室，然后那个人让我到3楼去看，还指着就是那个方向的那个屋子，我想这下找到了，但是到了3层之后，又问一个人，他说yxg老师不在这里，说是可能在rx楼或者yf楼，真奇怪，我就没直接走。然后一转身，竟然碰到刚才在楼地下碰到的那个向我问路的mm，笑盈盈的走了过去，真奇怪，这不是3楼么。然后我敲另外一个屋子的门，里面的人没有反应。外面倒是来了个人问我找谁，我说我找yxg老师，他奇怪地看着我说，你是考研的学生吧。我说我找yxg老师复印论文。他也说yxg老师不再这里。我就准备走了。看看几点，就收到了zyn发的短信，她说别人告诉她，可以通过馆际借阅那些论文，不麻烦我了，我也不用再跑了，回世宁。<br/><br/>看以前的那个codeblue和robot的论文。<br/><br/>忽然想到，最近考研的复试线该下了吧，就发短信给sm，她的分数比较悬，她也是很焦急，从短信看得出来。我查了那个学校今年和往年的招生的列表，然后计算了他的成绩在所有公布的人里的情况，在边缘上，但应该是可以复试了。然后安慰她说不要着急，好好休息。<br/><br/>中午去清真食堂吃饭，那里的菜还可以，只是贵了点。期间，tj的小弟打电话来说bh的分数线下来了，是315。大家都说今年的分数线太低了，真是丢人。其实我以前复习了两个月考的成绩也不高，但是对分数这个东西，却真是没有一点感觉。<br/><br/>下午来了继续看文章。<br/><br/>突然，看今天的日期是3.13。就想到了明天是yj 的生日，就给她发短信问。结果她好像很感动，但是因为工作的情况，今年不想过生日，但是我还是混到他一顿饭:P<br/><br/>看论文，研究公司的其他部门 的业务，产品。最后发现一个部门有MA认证，这是一个突破口，决定根据这个写一个场景的描述。同时，进一步想到了前一段美国的矿难时，他们好像使用了机器人来营救被困人，就此查到了美国劳工部专门有一个组织，矿山安全和健康委员会。上面有很多资料，现在需要初步了解这个行业，提出好的方案。<br/><br/>吃晚饭，fvv和我提到syf，我就开玩笑说，不要提她。然后，tj很关切的给我说有gf的好处等等，搞的我很不好意思。找到一个互相都喜欢的人是需要缘分的，我倒是不是很急。fvv说道师母，要给实验室的师兄介绍，赞那：）。最近开了一遍《围城》，的确是相当的经典的小说。最近爱胡思乱想，索性有找了一堆电子书，晚上下班后看。<br/><br/>从keso的blog的文章找到了阎辉的blog，还不错，上面有一篇文章吸引了我，<a href="../../yanhui/archive/2006/03/06/755162.aspx">最真实的2006年应届毕业生真实薪水</a>， 在他的blog里的照片又发现了开复和code jam的选手们的合影，真是羡慕阿，下一次是一定要参加，试试自己的实力。今天好像又在什么地方看到了上海交大获得了05年代acm程序设计大赛的全球总冠军，想到我一个叔叔的小孩wht，高二结束就保送到了上海交大去本硕博连读。这个小孩挺聪明的，也对计算机着迷，估计在下几次的比赛中会有他的身影。<br/><br/>看到google刚刚发表的<a href="http://www.google.com/mars/"> google mars</a>， google的人就是能想，这的确是很吸引人的。<br/><br/>看刘艺的文章，关于<a href="http://blog.sina.com.cn/u/543b9d40010003l1">教育</a>，真是感慨。<br/><br type="_moz"/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.donews.com/bubble/archive/2006/03/13/766536.aspx/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TinyOS社区的进展</title>
		<link>http://blog.donews.com/bubble/archive/2006/02/16/728788.aspx</link>
		<comments>http://blog.donews.com/bubble/archive/2006/02/16/728788.aspx#comments</comments>
		<pubDate>Thu, 16 Feb 2006 05:24:00 +0000</pubDate>
		<dc:creator>bubble</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://blog.donews.com/bubble/archive/2006/02/16/728788.aspx</guid>
		<description><![CDATA[值得关注的资料]]></description>
			<content:encoded><![CDATA[<p><br/>Pal写的新书：<a href="http://csl.stanford.edu/%7Epal/pubs/tinyos-programming-1-0.pdf">Programming TinyOS</a><br/><span style="font-family: monospace;"><br/></span>TinyOS技术交流会：<a href="http://csl.stanford.edu/~pal/ttx3-demos.html">TTX3 Demonstrations and Posters</a><br/>
<pre><a href="http://www.tinyos.net/scoop/story/2006/2/10/93050/8222"><font size="2" face="verdana, arial, helvetica, sans-serif">TinyOS 2.0 Beta Release</font></a></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.donews.com/bubble/archive/2006/02/16/728788.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>魔方</title>
		<link>http://blog.donews.com/bubble/archive/2006/02/07/718239.aspx</link>
		<comments>http://blog.donews.com/bubble/archive/2006/02/07/718239.aspx#comments</comments>
		<pubDate>Tue, 07 Feb 2006 12:18:00 +0000</pubDate>
		<dc:creator>bubble</dc:creator>
				<category><![CDATA[娱乐]]></category>

		<guid isPermaLink="false">http://blog.donews.com/bubble/archive/2006/02/07/718239.aspx</guid>
		<description><![CDATA[一些关于魔方的资源]]></description>
			<content:encoded><![CDATA[<p>年前，准备回家，到超市去买东西，突然发现了有魔方买，也不贵，5元，就买了一个。小小的魔方又勾起了在附中时的美好的回忆阿。还能记得那时有个数学大牛金某，大家都叫他老大吧，他玩魔方的速度超快，好像是一分钟以内吧，还给魔方建模，是我等崇拜的偶像阿。那时魔方很流行，那场面大阿，夸张的说，是人手一魔方阿，：P。<br/><br/>魔方的英文是magic cube，另外和这个词比较相近的也很有意思的是magic square，中文翻译成幻方（最简单的幻方是九宫格。有一个暑假我就借过一本关于幻方的书，看了后真是感觉不看不知道，世界真奇妙阿，关于幻方的世界也是相当的有趣，以后有时间再把关于幻方的也补上）<br/><br/>下面是关于魔方的一些资源：<br/><a href="http://www.ahtvu.ah.cn/jxc1/zhykch/3002/wwww.files/c2.htm">怎样玩魔方</a><br/><a href="http://mf8.nease.net/index.htm">国内很不错的一个站点，魔方吧</a><br/><a href="http://freehost18.websamba.com/rubik/home1.htm">另外一个摩方的站点，资料也很全</a><br/><a href="http://www.google.com/search?hl=zh-CN&amp;newwindow=1&amp;q=magic+cube+4d&amp;btnG=%E6%90%9C%E7%B4%A2&amp;lr=">更晕的4d魔方</a><br/><a href="http://members.shaw.ca/hdhcubes/">很多关于魔方的一些数学资料，也有和幻方相关的资源</a><br/><a href="http://www.math.ucf.edu/~reid/Rubik/">魔方的另一些资源，有书，软件等</a><br/>魔方applet：<br/><img src="/images/blog_donews_com/bubble/79846/79854/magic_cube.JPG" alt=""/><a href="http://www.schubart.net/rc/"><img width="365" height="293" src="/images/blog_donews_com/bubble/magic_cube.JPG" alt=""/></a><br type="_moz"/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.donews.com/bubble/archive/2006/02/07/718239.aspx/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>一个简单的统计源代码行数的脚本</title>
		<link>http://blog.donews.com/bubble/archive/2006/01/05/684030.aspx</link>
		<comments>http://blog.donews.com/bubble/archive/2006/01/05/684030.aspx#comments</comments>
		<pubDate>Thu, 05 Jan 2006 07:50:00 +0000</pubDate>
		<dc:creator>bubble</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://blog.donews.com/bubble/archive/2006/01/05/684030.aspx</guid>
		<description><![CDATA[突然想要统计自己写过的程序的行数，就写了一个小的脚本...]]></description>
			<content:encoded><![CDATA[<div style="text-align: left;">这给脚本程序的功能比较简单，还有很多可以完善的地方，但是其已经足够说明linux环境下的方便和强大<br/></div>
<p><br/><span class="Code">#!/bin/bash<br/><br/>args=$#<br/>progname=$0<br/>filetype=$1<br/>path=$2<br/><br/>function usage {<br/>&nbsp;&nbsp;&nbsp; echo &quot;==========================================&quot;<br/>&nbsp;&nbsp;&nbsp; echo &quot; Usage: $progname type path&quot;<br/>&nbsp;&nbsp;&nbsp; echo &quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type: the type of files what you want to count&nbsp; &quot;<br/>&nbsp;&nbsp;&nbsp; echo &quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; path: the path where the files are located&quot;<br/>&nbsp;&nbsp;&nbsp; echo &quot;==========================================&quot;<br/>}<br/><br/>function testArgs {<br/>&nbsp;&nbsp;&nbsp; if [ $args != $1 ]; then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; usage<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit<br/>&nbsp;&nbsp;&nbsp; fi<br/>}<br/><br/>testArgs 2<br/>find $path -name &quot;*.$filetype&quot; -print | xargs wc<br/>exit</span><br/><br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.donews.com/bubble/archive/2006/01/05/684030.aspx/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.538 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-02-11 07:15:53 -->
<!-- Compression = gzip -->
