Boost C++ Libraries: Ticket #1329: default value https://svn.boost.org/trac10/ticket/1329 <div class="wiki-code"><div class="code"><pre><span class="k">struct</span> <span class="n">default_</span> <span class="p">{</span> <span class="k">template</span><span class="o">&lt;</span><span class="k">class</span> <span class="nc">T</span><span class="o">&gt;</span> <span class="k">operator</span> <span class="n">T</span><span class="p">()</span> <span class="k">const</span> <span class="p">{</span> <span class="k">return</span> <span class="n">T</span><span class="p">();</span> <span class="p">}</span> <span class="p">};</span> </pre></div></div><p> Useful when you don't want to care about type of unimportant arguments. For example </p> <div class="wiki-code"><div class="code"><pre><span class="kt">void</span> <span class="nf">SomeFunction</span><span class="p">(</span><span class="n">Type1</span><span class="p">,</span> <span class="n">Type2</span><span class="p">,</span> <span class="n">Type3</span><span class="p">);</span> <span class="p">...</span> <span class="n">SomeFunction</span><span class="p">(</span><span class="n">default_</span><span class="p">(),</span> <span class="n">default_</span><span class="p">(),</span> <span class="n">default_</span><span class="p">());</span> </pre></div></div> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1329 Trac 1.4.3 John Maddock Sat, 10 Nov 2007 17:24:21 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/1329#comment:1 https://svn.boost.org/trac10/ticket/1329#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> Ideas like this that don't belong to any existing library are best discussed on the main developer mailing list: I'm closing the ticket down for now. </p> Ticket Sergey Shandar <sergey.junk@…> Tue, 13 Nov 2007 23:24:48 GMT <link>https://svn.boost.org/trac10/ticket/1329#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1329#comment:2</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/1329#comment:1" title="Comment 1">johnmaddock</a>: </p> <blockquote class="citation"> <p> Ideas like this that don't belong to any existing library are best discussed on the main developer mailing list: I'm closing the ticket down for now. </p> </blockquote> <p> Agree, now it is in the mailing list <a class="ext-link" href="http://thread.gmane.org/gmane.comp.lib.boost.devel/167706"><span class="icon">​</span>http://thread.gmane.org/gmane.comp.lib.boost.devel/167706</a> as a part of cast library. </p> </description> <category>Ticket</category> </item> </channel> </rss>