<div dir="ltr">I definitely think a library for generic CG compatible types would be great. I also think the standard library may need adaptation to allow integers and floats to be used in generic structures (there isn't common protocols for arithmetic operators, and those operators have different implications for signed vs unsigned, float versus integer, etc.). <div><br></div><div>However I do not think they are fundamental enough as data structures and data types to be in the standard library.</div><div><br></div><div>-1</div><div><br></div><div>I would support something like CGVector (for 1,2,4,8... components), if that can expose hardware vector optimisations that may not otherwise be accessible. However that may be implemented efficiently enough with a third party c library (like this <a href="https://github.com/mattt/Surge">https://github.com/mattt/Surge</a>), and afaik may already be under consideration for the built-in Float types.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 7, 2016 at 6:54 PM, Charles Constant via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>> <span style="font-size:13px">CGRectIntegral</span></div><div><span style="font-size:13px"><br></span></div><div><span style="font-size:13px">But that's conversion though, right? </span>That's part of what I find stressful. If I'm using Ints internally, I don't ever need to worry about getting wonky results because of floating point math.</div></div><span class=""><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 6, 2016 at 11:45 PM, John Randolph <span dir="ltr"><<a href="mailto:jcr@icloud.com" target="_blank">jcr@icloud.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
> On Jan 6, 2016, at 11:38 PM, Charles Constant <<a href="mailto:charles@charlesism.com" target="_blank">charles@charlesism.com</a>> wrote:<br>
><br>
> > I can certainly think of situations where I might want integer based rectangles, sizes, and points.<br>
><br>
> I'm quite biased this week, because I spent *yesterday* writing a file for my project with "IntRect" "IntPoint" "IntSize" ad nauseam. It's not something I'm very thrilled to have as part of my Audio app - a lone file of geometric structs that aready exist if you use CGFloats, where I don't get the full implementation, etc. And previously, I've written code that I needed land on whole numbers, and the extra concern about finding the right options in Cocoa to do so just stressed me out.<br>
<br>
</span>FWIW, NSIntegralRect() and CGRectIntegral() do exist. Note their entirely different naming conventions. ;-)<br>
<br>
Would be much nicer to just use myRect.integralRect when I need to round it. Might also be nice to have myRect.roundedOut and myRect.roundedIn for a bit more control of which way the sides move.<br>
<br>
-jcr<br>
<br>
<br>
</blockquote></div><br></div>
</span><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=pQw7h83fWt3LLbgkfL4TSUL0weaZnVFZxDe5GShw4uTkjOxhOxZ-2BLXxmo3z9CXIzR5bhlJoKB7HbEzS4PmAyAMT3bSnffqaCeJ-2FnuBZfhHAwQVIN5JOdZJPz9LS8pKqPzeaF9ay7JjcRoBmr2WXTzsPVSyzZtRJxyuLxHTEkv0n-2Ffh4rS2VRScTTgpUEx-2BCnzcuWFT3oOp7qgTWq3D2w2vZ5b0LaDe8NH8hj-2BTkGjaM-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>