﻿<?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++博客-Edgard-最新评论</title><link>http://www.cppblog.com/Edgard/CommentsRSS.aspx</link><description /><language>zh-cn</language><pubDate>Fri, 16 Dec 2005 02:26:00 GMT</pubDate><lastBuildDate>Fri, 16 Dec 2005 02:26:00 GMT</lastBuildDate><generator>cnblogs</generator><item><title>re: 讨论FunctionTemplate申明的隐藏性（Visibility）</title><link>http://www.cppblog.com/Edgard/archive/2007/05/27/1805.html#24958</link><dc:creator>xiongx</dc:creator><author>xiongx</author><pubDate>Sun, 27 May 2007 15:37:00 GMT</pubDate><guid>http://www.cppblog.com/Edgard/archive/2007/05/27/1805.html#24958</guid><description><![CDATA[这玩意跟C的先申明后使用是一脉相承的吧，template的很多编译策略都是看起来能用就行，不会顾及全面的<img src ="http://www.cppblog.com/Edgard/aggbug/24958.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Edgard/" target="_blank">xiongx</a> 2007-05-27 23:37 <a href="http://www.cppblog.com/Edgard/archive/2007/05/27/1805.html#24958#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: VC编译器对FunctionTemplate实例化的优化</title><link>http://www.cppblog.com/Edgard/archive/2006/03/05/1804.html#3766</link><dc:creator>filcon</dc:creator><author>filcon</author><pubDate>Sun, 05 Mar 2006 13:02:00 GMT</pubDate><guid>http://www.cppblog.com/Edgard/archive/2006/03/05/1804.html#3766</guid><description><![CDATA[一楼说得对<img src ="http://www.cppblog.com/Edgard/aggbug/3766.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Edgard/" target="_blank">filcon</a> 2006-03-05 21:02 <a href="http://www.cppblog.com/Edgard/archive/2006/03/05/1804.html#3766#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 讨论FunctionTemplate申明的隐藏性（Visibility）</title><link>http://www.cppblog.com/Edgard/archive/2006/01/08/1805.html#2492</link><dc:creator>chenchen</dc:creator><author>chenchen</author><pubDate>Sun, 08 Jan 2006 12:27:00 GMT</pubDate><guid>http://www.cppblog.com/Edgard/archive/2006/01/08/1805.html#2492</guid><description><![CDATA[&lt;c++ template&gt;上说必须把重载的写在template的前面,然而我在vs2003上的测试是无所谓,至于标准上怎么说那我就不知道了,写在前面就一定保险,写在后面估计是有危险!<img src ="http://www.cppblog.com/Edgard/aggbug/2492.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Edgard/" target="_blank">chenchen</a> 2006-01-08 20:27 <a href="http://www.cppblog.com/Edgard/archive/2006/01/08/1805.html#2492#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: VC编译器对FunctionTemplate实例化的优化</title><link>http://www.cppblog.com/Edgard/archive/2005/12/17/1804.html#1848</link><dc:creator>清风雨</dc:creator><author>清风雨</author><pubDate>Sat, 17 Dec 2005 07:12:00 GMT</pubDate><guid>http://www.cppblog.com/Edgard/archive/2005/12/17/1804.html#1848</guid><description><![CDATA[这个不是优化，是语言本身对模板的要求。也就是说C++语言本身就决定了这个结果是必然结果。不管那个编译器正确的行为都是这个结果。而不是编译器的代码优化。<img src ="http://www.cppblog.com/Edgard/aggbug/1848.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Edgard/" target="_blank">清风雨</a> 2005-12-17 15:12 <a href="http://www.cppblog.com/Edgard/archive/2005/12/17/1804.html#1848#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 讨论FunctionTemplate申明的隐藏性（Visibility）</title><link>http://www.cppblog.com/Edgard/archive/2005/12/17/1805.html#1847</link><dc:creator>清风雨</dc:creator><author>清风雨</author><pubDate>Sat, 17 Dec 2005 07:08:00 GMT</pubDate><guid>http://www.cppblog.com/Edgard/archive/2005/12/17/1805.html#1847</guid><description><![CDATA[无意闯到这边来了。<br><br>我是在对几个概念不太清楚的情况下，想找找说明。本来是不管这些概念的，但，我想试试特化是不小心写错了，编译器告诉我无法显示化。<br>我就纳闷了，特化、偏特化、显示化，所以，想找找概念的介绍，一不小心发现了这个blog站，而你说的问题，我又忍不住想开一下口。^_^<br><br>关于特化的匹配原则，就像我们期望的那样，编译器是优选最接近的。<br>最简单的测试方法，就是针对模板圆形，特化形式分别给出不同输出，这样，一眼便能知道编译器选了谁。<img src ="http://www.cppblog.com/Edgard/aggbug/1847.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Edgard/" target="_blank">清风雨</a> 2005-12-17 15:08 <a href="http://www.cppblog.com/Edgard/archive/2005/12/17/1805.html#1847#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 讨论FunctionTemplate申明的隐藏性（Visibility）</title><link>http://www.cppblog.com/Edgard/archive/2005/12/16/1805.html#1820</link><dc:creator>Edgard</dc:creator><author>Edgard</author><pubDate>Fri, 16 Dec 2005 04:47:00 GMT</pubDate><guid>http://www.cppblog.com/Edgard/archive/2005/12/16/1805.html#1820</guid><description><![CDATA[上面是我读一本书测试过的例子，书中曾说：This is only one example of code that might behave differently than expected as a result of detailed overload resolution rules. For example, the fact that not all overloaded functions are visible when a corresponding function call is made may or may not matter. In fact, defining a three-argument version of max() without having seen the declaration of a special two-argument version of max() for ints causes the two-argument template to be used by the three-argument version:，这里的意思比较适合第二种情况，即”一个是：inline int const&amp; max申明在template &lt;typename T&gt; <br>inline T const&amp; max之后。”，我没有能在其他C++编译器上测试过，不知道C++标准中是否规定FunctionTemplate Resolution Rules，如果没有，依据上面的英文描述，不同编译器有不同的FunctionTemplate Resolution Rule，有可能template &lt;typename T&gt; <br>inline T const&amp; max (T const&amp; a, T const&amp; b, T const&amp; c) 不可见到申明在后的inline int const&amp; max。<br><br>大家的意见呢？<img src ="http://www.cppblog.com/Edgard/aggbug/1820.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Edgard/" target="_blank">Edgard</a> 2005-12-16 12:47 <a href="http://www.cppblog.com/Edgard/archive/2005/12/16/1805.html#1820#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 讨论FunctionTemplate申明的隐藏性（Visibility）</title><link>http://www.cppblog.com/Edgard/archive/2005/12/16/1805.html#1817</link><dc:creator>小明</dc:creator><author>小明</author><pubDate>Fri, 16 Dec 2005 02:26:00 GMT</pubDate><guid>http://www.cppblog.com/Edgard/archive/2005/12/16/1805.html#1817</guid><description><![CDATA[Function templates can be overloaded with nontemplate functions. All else being equal, the nontemplate function is preferred in Function templates can be overloaded with nontemplate functions. All else being equal, the nontemplate function is preferred in selecting the actual function being called. The following example illustrates this:<br><br>// details/nontmpl.cpp <br><br>#include &lt;string&gt; <br>#include &lt;iostream&gt; <br><br>template&lt;typename T&gt;<br>std::string f(T) <br>{ <br>    return "Template"; <br>} <br><br>std::string f(int&) <br>{ <br>    return "Nontemplate"; <br>} <br><br>int main() <br>{ <br>    int x = 7; <br>    std::cout << f(x) << std::endl; <br>} <br>This should output:<br><br>Nontemplate <br><br><br>以上是C++ templates的原文。<br>所以nontemplate的函数应该被匹配调用，跟声明的前后没关系<br><br><img src ="http://www.cppblog.com/Edgard/aggbug/1817.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Edgard/" target="_blank">小明</a> 2005-12-16 10:26 <a href="http://www.cppblog.com/Edgard/archive/2005/12/16/1805.html#1817#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>