<div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr">On Mon, 14 Jan 2019 at 20:51, John Spicer <<a href="mailto:jhs@edg.com">jhs@edg.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">I agree with your conclusion.<br>
<br>
A question came up recently about whether nested inline namespaces (P1094R2) needed a feature test macro. In the CWG discussion Alisdair said there was intentionally no feature test macro.<br>
<br>
It might be helpful for proposals to that do not have a feature test macro to say so explicitly so that we know whether it was by design or an oversight.<br>
<br></blockquote><div><br></div><div>It might also be useful to write up the "if you have to write the alternative code anyway, you might as well just do that" principle in SD-6, so we can point people to it.</div><div><br></div><div>Assign that task to me if you like, although I might not be able to get around to it for a while.</div><div><br></div><div><br></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">
John.<br>
<br>
> On Jan 11, 2019, at 10:31 AM, Jonathan Wakely <<a href="mailto:cxx@kayari.org" target="_blank">cxx@kayari.org</a>> wrote:<br>
> <br>
> A colleague queried the absence of a feature-test macro for<br>
> <a href="https://wg21.link/p0458" rel="noreferrer" target="_blank">https://wg21.link/p0458</a> "Checking for Existence of an Element in<br>
> Associative Containers".<br>
> <br>
> I couldn't find any record of discussion in LWG review or on this<br>
> mailing list to indicate whether the omission was intentional or an<br>
> oversight.<br>
> <br>
> IMHO there's not much need for a macro, based on the "if you have to<br>
> write the alternative code anyway, you might as well just do that"<br>
> principle. i.e. the macro allows you to write:<br>
> <br>
> #if __cpp_lib_assoc_contains<br>
> if (cont.contains(key))<br>
> #else<br>
> if (cont.find(key) != cont.end())<br>
> #endif<br>
> {<br>
> // ...<br>
> }<br>
> <br>
> But the performance characteristics of the two forms are identical, so<br>
> checking the macro just obfuscates the code. If you need to support<br>
> old compilers, just write the code the old way.<br>
> <br>
> The new contains member is more efficient than a badly-written check<br>
> for multimaps and multisets that uses "count":<br>
> <br>
> #if __cpp_lib_assoc_contains<br>
> if (cont.contains(key))<br>
> #else<br>
> if (cont.count(key) != 0)<br>
> #endif<br>
> {<br>
> // ...<br>
> }<br>
> <br>
> But this code should be fixed anyway.<br>
> <br>
> Does SG10 agree that we don't need a macro for p0458?<br>
> _______________________________________________<br>
> Features mailing list<br>
> <a href="mailto:Features@isocpp.open-std.org" target="_blank">Features@isocpp.open-std.org</a><br>
> <a href="http://www.open-std.org/mailman/listinfo/features" rel="noreferrer" target="_blank">http://www.open-std.org/mailman/listinfo/features</a><br>
<br>
</blockquote></div></div></div>