<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0">Hi Csaba,</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">Thank you for the quick reply! That's true it creates a new type, but I would like to know at the point of template instantiation where the <font size="2"><span style="font-size:11pt">typedef T type</span></font> (from
your example) is worked out from the original past in type within the compiler. If that's a thing that occurs of course. </p>
</div>
<div dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<br>
<p style="margin-top:0; margin-bottom:0">I'm unfortunately not entirely familiar with how it works so I could be wrong, but I imagine the T component needs to be deduced at some point and separated from the const component. So that you'd end up with an int
instead of an const int for example. <br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"></p>
<p style="margin-top:0; margin-bottom:0"><span></p>
<div>Sorry if I'm not making sense and <span>I apologize for phrasing my initial question quite badly. I'll try to be a little more careful with my wording in the future. </span></div>
</span>
<p></p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p></p>
<p style="margin-top:0; margin-bottom:0"></p>
</div>
<div dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0">Best Regards,</p>
<p style="margin-top:0; margin-bottom:0">Andrew <br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Csaba Raduly <rcsaba@gmail.com><br>
<b>Sent:</b> 13 August 2018 09:37:09<br>
<b>To:</b> Andrew Gozillon<br>
<b>Cc:</b> cfe-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [cfe-dev] Template Qualifier Removal Question</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Hi Andrew,<br>
<br>
<br>
On Mon, Aug 13, 2018 at 8:36 AM, Andrew Gozillon via cfe-dev<br>
<cfe-dev@lists.llvm.org> wrote:<br>
> Hi,<br>
><br>
> I have a question relating to template metafunctions like remove_const that<br>
> split a type from its qualifiers.<br>
><br>
> I was wondering where in Clang the decision to remove const (or another<br>
> qualifier or pointer) from a type is made when using templates and then<br>
> where it's performed (the new type generated)?<br>
<br>
Are you talking about std::remove_const (<br>
<a href="https://en.cppreference.com/w/cpp/types/remove_cv" id="LPlnk608424" class="OWAAutoLink" previewremoved="true">https://en.cppreference.com/w/cpp/types/remove_cv</a> ) ?
<div id="LPBorder_GT_15341467514860.05851184693896205" style="margin-bottom:20px; overflow:auto; width:100%; text-indent:0px">
<table id="LPContainer_15341467514850.2789332688775248" style="width:90%; background-color:rgb(255,255,255); overflow:auto; padding-top:20px; padding-bottom:20px; margin-top:20px; border-top:1px dotted rgb(200,200,200); border-bottom:1px dotted rgb(200,200,200)" cellspacing="0">
<tbody>
<tr style="border-spacing:0px" valign="top">
<td id="TextCell_15341467514850.999384205489536" colspan="2" style="vertical-align: top; padding: 0px; display: table-cell; position: relative;">
<div id="LPRemovePreviewContainer_15341467514850.8611094561775076"></div>
<div id="LPTitle_15341467514850.5900624183038042" style="top:0px; color:rgb(0,120,215); font-weight:400; font-size:21px; font-family:"wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; line-height:21px">
<a id="LPUrlAnchor_15341467514850.3360748566466154" href="https://en.cppreference.com/w/cpp/types/remove_cv" target="_blank" style="text-decoration:none">std::remove_cv, std::remove_const, std::remove_volatile ...</a></div>
<div id="LPMetadata_15341467514850.07797930711133028" style="margin:10px 0px 16px; color:rgb(102,102,102); font-weight:400; font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:14px">
en.cppreference.com</div>
<div id="LPDescription_15341467514860.03978128065250153" style="display:block; color:rgb(102,102,102); font-weight:400; font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:20px; max-height:100px; overflow:hidden">
Provides the member typedef type which is the same as T, except that its topmost cv-qualifiers are removed.. 1) removes the topmost const, the topmost volatile, or both, if present.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
I have bad news: std::remove_const doesn't remove const from a type.<br>
It merely creates another type.<br>
<br>
>From the "Possible implementation" :<br>
<br>
template< class T > struct remove_const { typedef T type; };<br>
template< class T > struct remove_const<const T> { typedef T type; };<br>
<br>
remove_const<T> creates a new type ( remove_const<T>::type ) which is<br>
exactly the same as T,<br>
except if T is const, remove_const<T>::type isn't.<br>
<br>
<br>
Csaba<br>
-- <br>
You can get very substantial performance improvements<br>
by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler<br>
So if you're looking for a completely portable, 100% standards-conformat way<br>
to get the wrong information: this is what you want. - Scott Meyers (C++TDaWYK)<br>
</div>
</span></font></div>
</div>
</body>
</html>