This sentence is about *variable* templates, not "variadic" templates.<br><br><div class="gmail_quote"><div dir="ltr">On Sat, Mar 9, 2019, 9:57 AM Владимир Гончаров via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org">libcxx-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><blockquote type="cite"><div dir="ltr"><div class="gmail_quote"><div>Where does the standard say that?</div></div></div></blockquote><div><br></div><a href="http://eel.is/c++draft/namespace.std#3" target="_blank">[namespace.std].3</a>: The behavior of a C++ program is undefined if it declares an explicit or partial specialization of any standard library variable template, except where explicitly permitted by the specification of that variable template.</div><div style="word-wrap:break-word;line-break:after-white-space"><div><br><blockquote type="cite"><div>On 9 Mar 2019, at 04:49, Eric Fiselier <<a href="mailto:eric@efcs.ca" target="_blank">eric@efcs.ca</a>> wrote:</div><br class="m_-1069606291388146666Apple-interchange-newline"><div><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 7, 2019 at 10:18 AM Владимир Гончаров <<a href="mailto:dev.zelta@gmail.com" target="_blank">dev.zelta@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><blockquote type="cite"><div dir="ltr"><div class="gmail_quote"><div>Can you explain what your specialization does differently? And why it's needed?</div></div></div></blockquote></div><div><br></div>I have a class which is a C++ interface for an object defined in a C library. Internally, it is a pointer which can never be null (if C interface returns null, the class constructor throws).<div><div>I want to use this fact to optimise optional's storage. That would allow shrinking optional's size to eight bytes. Since we store a lot of optionals of this class, this change would reduce memory usage by about five percent (I've done some testing).</div><div>I really don't want to invent a new optional specifically for this case. I also don't want to allow storing null pointers inside of the original class because this would require an assert before almost any usage of the class.</div><div><br></div><div><blockquote type="cite"><div dir="ltr"><div class="gmail_quote"><div>I think the standard is being too permissive here.</div></div></div></blockquote></div><div><br></div><div>Maybe it is. But again, if I can provide a more efficient specialization which would utilise some knowledge about the wrapped type, why shouldn't I?</div><div><br></div><div><blockquote type="cite"><div dir="ltr"><div class="gmail_quote"><div>`<variant>` is a good example.</div></div></div></blockquote></div><div><br></div><div>By the way, providing custom specializations for variadic templates is forbidden =)</div></div></div></blockquote><div><br></div><div>Where does the standard say that?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div><br><div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">Kind regards, Vladimir Goncharov</div>
</div>
<div><br><blockquote type="cite"><div>On 7 Mar 2019, at 08:39, Eric Fiselier <<a href="mailto:eric@efcs.ca" target="_blank">eric@efcs.ca</a>> wrote:</div><br class="m_-1069606291388146666gmail-m_453535719501650042Apple-interchange-newline"><div><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 6, 2019 at 5:41 PM Владимир Гончаров via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org" target="_blank">libcxx-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div dir="auto">Hello!<div><br></div><div>I'm implementing a specialization for std::optional for my program-defined type. </div></div></div></blockquote><div><br></div><div>Can you explain what your specialization does differently? And why it's needed?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div dir="auto"><div>As I understand <font color="#0069d9"><u>[namespace.std]</u></font>, nothing forbids me from doing that.</div></div></div></blockquote><div><br></div><div>I agree that you've interpreted the standard correctly. But I think the standard is being too permissive here.</div><div>Implementing a complex component may necessitate knowledge of the internals. `<variant>` is a good example.</div><div></div><div><br></div><div>I would like to know what other library maintainers think.</div><div> </div><div>/Eric</div></div></div>
</div></blockquote></div><br></div></div></div></blockquote></div></div>
</div></blockquote></div><br></div>_______________________________________________<br>
libcxx-dev mailing list<br>
<a href="mailto:libcxx-dev@lists.llvm.org" target="_blank">libcxx-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev</a><br>
</blockquote></div>