<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	
	>
<channel>
	<title>
	Comments on: Default Parameters With Default Template Parameters Types	</title>
	<atom:link href="https://www.fluentcpp.com/2018/08/10/template-default-arguments-application-smart-iterators/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fluentcpp.com/2018/08/10/template-default-arguments-application-smart-iterators/</link>
	<description>Jonathan Boccara&#039;s blog</description>
	<lastBuildDate>Thu, 11 Jul 2019 23:30:35 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.4</generator>
	<item>
		<title>
		By: jft		</title>
		<link>https://www.fluentcpp.com/2018/08/10/template-default-arguments-application-smart-iterators/#comment-1212</link>

		<dc:creator><![CDATA[jft]]></dc:creator>
		<pubDate>Fri, 10 Aug 2018 09:44:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=1882#comment-1212</guid>

					<description><![CDATA[If you have a templated function such as

template
std::optional stofp(const std::string&#038; st)
{
... 
	auto v = T {};
 ... 
	return ok ? v : std::optional {};
}

then you can call it either like

auto r = stofp(&quot;12.56&quot;);

which defaults T to double without any  being used

or like

auto i = stofp(&quot;123445&quot;);

where the type of T is specified (here as an int)

so only when the non-defaulted type of T is needed are any  required.

You can specify the default value for T by

auto rd = stofp(&quot;12.56&quot;);


but the empty  are not needed in this case.]]></description>
			<content:encoded><![CDATA[<p>If you have a templated function such as</p>
<p>template<br />
std::optional stofp(const std::string&amp; st)<br />
{<br />
&#8230;<br />
	auto v = T {};<br />
 &#8230;<br />
	return ok ? v : std::optional {};<br />
}</p>
<p>then you can call it either like</p>
<p>auto r = stofp(&#8220;12.56&#8221;);</p>
<p>which defaults T to double without any  being used</p>
<p>or like</p>
<p>auto i = stofp(&#8220;123445&#8221;);</p>
<p>where the type of T is specified (here as an int)</p>
<p>so only when the non-defaulted type of T is needed are any  required.</p>
<p>You can specify the default value for T by</p>
<p>auto rd = stofp(&#8220;12.56&#8221;);</p>
<p>but the empty  are not needed in this case.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
