暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

NativeParallelHashSetExtensions.gen.cs 46KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200
  1. using System;
  2. using Unity.Collections.LowLevel.Unsafe;
  3. namespace Unity.Collections
  4. {
  5. /// <summary>
  6. /// Provides extension methods for sets.
  7. /// </summary>
  8. public unsafe static class HashSetExtensions
  9. {
  10. /// <summary>
  11. /// Removes the values from this set which are also present in another collection.
  12. /// </summary>
  13. /// <typeparam name="T">The type of values.</typeparam>
  14. /// <param name="container">The set to remove values from.</param>
  15. /// <param name="other">The collection to compare with.</param>
  16. public static void ExceptWith<T>(this ref NativeHashSet<T> container, FixedList128Bytes<T> other)
  17. where T : unmanaged, IEquatable<T>
  18. {
  19. foreach (var item in other)
  20. {
  21. container.Remove(item);
  22. }
  23. }
  24. /// <summary>
  25. /// Removes the values from this set which are absent in another collection.
  26. /// </summary>
  27. /// <typeparam name="T">The type of values.</typeparam>
  28. /// <param name="container">The set to remove values from.</param>
  29. /// <param name="other">The collection to compare with.</param>
  30. public static void IntersectWith<T>(this ref NativeHashSet<T> container, FixedList128Bytes<T> other)
  31. where T : unmanaged, IEquatable<T>
  32. {
  33. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  34. foreach (var item in other)
  35. {
  36. if (container.Contains(item))
  37. {
  38. result.Add(item);
  39. }
  40. }
  41. container.Clear();
  42. container.UnionWith(result);
  43. result.Dispose();
  44. }
  45. /// <summary>
  46. /// Adds all values from a collection to this set.
  47. /// </summary>
  48. /// <typeparam name="T">The type of values.</typeparam>
  49. /// <param name="container">The set to add values to.</param>
  50. /// <param name="other">The collection to copy values from.</param>
  51. public static void UnionWith<T>(this ref NativeHashSet<T> container, FixedList128Bytes<T> other)
  52. where T : unmanaged, IEquatable<T>
  53. {
  54. foreach (var item in other)
  55. {
  56. container.Add(item);
  57. }
  58. }
  59. /// <summary>
  60. /// Removes the values from this set which are also present in another collection.
  61. /// </summary>
  62. /// <typeparam name="T">The type of values.</typeparam>
  63. /// <param name="container">The set to remove values from.</param>
  64. /// <param name="other">The collection to compare with.</param>
  65. public static void ExceptWith<T>(this ref NativeHashSet<T> container, FixedList32Bytes<T> other)
  66. where T : unmanaged, IEquatable<T>
  67. {
  68. foreach (var item in other)
  69. {
  70. container.Remove(item);
  71. }
  72. }
  73. /// <summary>
  74. /// Removes the values from this set which are absent in another collection.
  75. /// </summary>
  76. /// <typeparam name="T">The type of values.</typeparam>
  77. /// <param name="container">The set to remove values from.</param>
  78. /// <param name="other">The collection to compare with.</param>
  79. public static void IntersectWith<T>(this ref NativeHashSet<T> container, FixedList32Bytes<T> other)
  80. where T : unmanaged, IEquatable<T>
  81. {
  82. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  83. foreach (var item in other)
  84. {
  85. if (container.Contains(item))
  86. {
  87. result.Add(item);
  88. }
  89. }
  90. container.Clear();
  91. container.UnionWith(result);
  92. result.Dispose();
  93. }
  94. /// <summary>
  95. /// Adds all values from a collection to this set.
  96. /// </summary>
  97. /// <typeparam name="T">The type of values.</typeparam>
  98. /// <param name="container">The set to add values to.</param>
  99. /// <param name="other">The collection to copy values from.</param>
  100. public static void UnionWith<T>(this ref NativeHashSet<T> container, FixedList32Bytes<T> other)
  101. where T : unmanaged, IEquatable<T>
  102. {
  103. foreach (var item in other)
  104. {
  105. container.Add(item);
  106. }
  107. }
  108. /// <summary>
  109. /// Removes the values from this set which are also present in another collection.
  110. /// </summary>
  111. /// <typeparam name="T">The type of values.</typeparam>
  112. /// <param name="container">The set to remove values from.</param>
  113. /// <param name="other">The collection to compare with.</param>
  114. public static void ExceptWith<T>(this ref NativeHashSet<T> container, FixedList4096Bytes<T> other)
  115. where T : unmanaged, IEquatable<T>
  116. {
  117. foreach (var item in other)
  118. {
  119. container.Remove(item);
  120. }
  121. }
  122. /// <summary>
  123. /// Removes the values from this set which are absent in another collection.
  124. /// </summary>
  125. /// <typeparam name="T">The type of values.</typeparam>
  126. /// <param name="container">The set to remove values from.</param>
  127. /// <param name="other">The collection to compare with.</param>
  128. public static void IntersectWith<T>(this ref NativeHashSet<T> container, FixedList4096Bytes<T> other)
  129. where T : unmanaged, IEquatable<T>
  130. {
  131. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  132. foreach (var item in other)
  133. {
  134. if (container.Contains(item))
  135. {
  136. result.Add(item);
  137. }
  138. }
  139. container.Clear();
  140. container.UnionWith(result);
  141. result.Dispose();
  142. }
  143. /// <summary>
  144. /// Adds all values from a collection to this set.
  145. /// </summary>
  146. /// <typeparam name="T">The type of values.</typeparam>
  147. /// <param name="container">The set to add values to.</param>
  148. /// <param name="other">The collection to copy values from.</param>
  149. public static void UnionWith<T>(this ref NativeHashSet<T> container, FixedList4096Bytes<T> other)
  150. where T : unmanaged, IEquatable<T>
  151. {
  152. foreach (var item in other)
  153. {
  154. container.Add(item);
  155. }
  156. }
  157. /// <summary>
  158. /// Removes the values from this set which are also present in another collection.
  159. /// </summary>
  160. /// <typeparam name="T">The type of values.</typeparam>
  161. /// <param name="container">The set to remove values from.</param>
  162. /// <param name="other">The collection to compare with.</param>
  163. public static void ExceptWith<T>(this ref NativeHashSet<T> container, FixedList512Bytes<T> other)
  164. where T : unmanaged, IEquatable<T>
  165. {
  166. foreach (var item in other)
  167. {
  168. container.Remove(item);
  169. }
  170. }
  171. /// <summary>
  172. /// Removes the values from this set which are absent in another collection.
  173. /// </summary>
  174. /// <typeparam name="T">The type of values.</typeparam>
  175. /// <param name="container">The set to remove values from.</param>
  176. /// <param name="other">The collection to compare with.</param>
  177. public static void IntersectWith<T>(this ref NativeHashSet<T> container, FixedList512Bytes<T> other)
  178. where T : unmanaged, IEquatable<T>
  179. {
  180. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  181. foreach (var item in other)
  182. {
  183. if (container.Contains(item))
  184. {
  185. result.Add(item);
  186. }
  187. }
  188. container.Clear();
  189. container.UnionWith(result);
  190. result.Dispose();
  191. }
  192. /// <summary>
  193. /// Adds all values from a collection to this set.
  194. /// </summary>
  195. /// <typeparam name="T">The type of values.</typeparam>
  196. /// <param name="container">The set to add values to.</param>
  197. /// <param name="other">The collection to copy values from.</param>
  198. public static void UnionWith<T>(this ref NativeHashSet<T> container, FixedList512Bytes<T> other)
  199. where T : unmanaged, IEquatable<T>
  200. {
  201. foreach (var item in other)
  202. {
  203. container.Add(item);
  204. }
  205. }
  206. /// <summary>
  207. /// Removes the values from this set which are also present in another collection.
  208. /// </summary>
  209. /// <typeparam name="T">The type of values.</typeparam>
  210. /// <param name="container">The set to remove values from.</param>
  211. /// <param name="other">The collection to compare with.</param>
  212. public static void ExceptWith<T>(this ref NativeHashSet<T> container, FixedList64Bytes<T> other)
  213. where T : unmanaged, IEquatable<T>
  214. {
  215. foreach (var item in other)
  216. {
  217. container.Remove(item);
  218. }
  219. }
  220. /// <summary>
  221. /// Removes the values from this set which are absent in another collection.
  222. /// </summary>
  223. /// <typeparam name="T">The type of values.</typeparam>
  224. /// <param name="container">The set to remove values from.</param>
  225. /// <param name="other">The collection to compare with.</param>
  226. public static void IntersectWith<T>(this ref NativeHashSet<T> container, FixedList64Bytes<T> other)
  227. where T : unmanaged, IEquatable<T>
  228. {
  229. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  230. foreach (var item in other)
  231. {
  232. if (container.Contains(item))
  233. {
  234. result.Add(item);
  235. }
  236. }
  237. container.Clear();
  238. container.UnionWith(result);
  239. result.Dispose();
  240. }
  241. /// <summary>
  242. /// Adds all values from a collection to this set.
  243. /// </summary>
  244. /// <typeparam name="T">The type of values.</typeparam>
  245. /// <param name="container">The set to add values to.</param>
  246. /// <param name="other">The collection to copy values from.</param>
  247. public static void UnionWith<T>(this ref NativeHashSet<T> container, FixedList64Bytes<T> other)
  248. where T : unmanaged, IEquatable<T>
  249. {
  250. foreach (var item in other)
  251. {
  252. container.Add(item);
  253. }
  254. }
  255. /// <summary>
  256. /// Removes the values from this set which are also present in another collection.
  257. /// </summary>
  258. /// <typeparam name="T">The type of values.</typeparam>
  259. /// <param name="container">The set to remove values from.</param>
  260. /// <param name="other">The collection to compare with.</param>
  261. public static void ExceptWith<T>(this ref NativeHashSet<T> container, NativeArray<T> other)
  262. where T : unmanaged, IEquatable<T>
  263. {
  264. foreach (var item in other)
  265. {
  266. container.Remove(item);
  267. }
  268. }
  269. /// <summary>
  270. /// Removes the values from this set which are absent in another collection.
  271. /// </summary>
  272. /// <typeparam name="T">The type of values.</typeparam>
  273. /// <param name="container">The set to remove values from.</param>
  274. /// <param name="other">The collection to compare with.</param>
  275. public static void IntersectWith<T>(this ref NativeHashSet<T> container, NativeArray<T> other)
  276. where T : unmanaged, IEquatable<T>
  277. {
  278. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  279. foreach (var item in other)
  280. {
  281. if (container.Contains(item))
  282. {
  283. result.Add(item);
  284. }
  285. }
  286. container.Clear();
  287. container.UnionWith(result);
  288. result.Dispose();
  289. }
  290. /// <summary>
  291. /// Adds all values from a collection to this set.
  292. /// </summary>
  293. /// <typeparam name="T">The type of values.</typeparam>
  294. /// <param name="container">The set to add values to.</param>
  295. /// <param name="other">The collection to copy values from.</param>
  296. public static void UnionWith<T>(this ref NativeHashSet<T> container, NativeArray<T> other)
  297. where T : unmanaged, IEquatable<T>
  298. {
  299. foreach (var item in other)
  300. {
  301. container.Add(item);
  302. }
  303. }
  304. /// <summary>
  305. /// Removes the values from this set which are also present in another collection.
  306. /// </summary>
  307. /// <typeparam name="T">The type of values.</typeparam>
  308. /// <param name="container">The set to remove values from.</param>
  309. /// <param name="other">The collection to compare with.</param>
  310. public static void ExceptWith<T>(this ref NativeHashSet<T> container, NativeHashSet<T> other)
  311. where T : unmanaged, IEquatable<T>
  312. {
  313. foreach (var item in other)
  314. {
  315. container.Remove(item);
  316. }
  317. }
  318. /// <summary>
  319. /// Removes the values from this set which are absent in another collection.
  320. /// </summary>
  321. /// <typeparam name="T">The type of values.</typeparam>
  322. /// <param name="container">The set to remove values from.</param>
  323. /// <param name="other">The collection to compare with.</param>
  324. public static void IntersectWith<T>(this ref NativeHashSet<T> container, NativeHashSet<T> other)
  325. where T : unmanaged, IEquatable<T>
  326. {
  327. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  328. foreach (var item in other)
  329. {
  330. if (container.Contains(item))
  331. {
  332. result.Add(item);
  333. }
  334. }
  335. container.Clear();
  336. container.UnionWith(result);
  337. result.Dispose();
  338. }
  339. /// <summary>
  340. /// Adds all values from a collection to this set.
  341. /// </summary>
  342. /// <typeparam name="T">The type of values.</typeparam>
  343. /// <param name="container">The set to add values to.</param>
  344. /// <param name="other">The collection to copy values from.</param>
  345. public static void UnionWith<T>(this ref NativeHashSet<T> container, NativeHashSet<T> other)
  346. where T : unmanaged, IEquatable<T>
  347. {
  348. foreach (var item in other)
  349. {
  350. container.Add(item);
  351. }
  352. }
  353. /// <summary>
  354. /// Removes the values from this set which are also present in another collection.
  355. /// </summary>
  356. /// <typeparam name="T">The type of values.</typeparam>
  357. /// <param name="container">The set to remove values from.</param>
  358. /// <param name="other">The collection to compare with.</param>
  359. public static void ExceptWith<T>(this ref NativeHashSet<T> container, NativeHashSet<T>.ReadOnly other)
  360. where T : unmanaged, IEquatable<T>
  361. {
  362. foreach (var item in other)
  363. {
  364. container.Remove(item);
  365. }
  366. }
  367. /// <summary>
  368. /// Removes the values from this set which are absent in another collection.
  369. /// </summary>
  370. /// <typeparam name="T">The type of values.</typeparam>
  371. /// <param name="container">The set to remove values from.</param>
  372. /// <param name="other">The collection to compare with.</param>
  373. public static void IntersectWith<T>(this ref NativeHashSet<T> container, NativeHashSet<T>.ReadOnly other)
  374. where T : unmanaged, IEquatable<T>
  375. {
  376. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  377. foreach (var item in other)
  378. {
  379. if (container.Contains(item))
  380. {
  381. result.Add(item);
  382. }
  383. }
  384. container.Clear();
  385. container.UnionWith(result);
  386. result.Dispose();
  387. }
  388. /// <summary>
  389. /// Adds all values from a collection to this set.
  390. /// </summary>
  391. /// <typeparam name="T">The type of values.</typeparam>
  392. /// <param name="container">The set to add values to.</param>
  393. /// <param name="other">The collection to copy values from.</param>
  394. public static void UnionWith<T>(this ref NativeHashSet<T> container, NativeHashSet<T>.ReadOnly other)
  395. where T : unmanaged, IEquatable<T>
  396. {
  397. foreach (var item in other)
  398. {
  399. container.Add(item);
  400. }
  401. }
  402. /// <summary>
  403. /// Removes the values from this set which are also present in another collection.
  404. /// </summary>
  405. /// <typeparam name="T">The type of values.</typeparam>
  406. /// <param name="container">The set to remove values from.</param>
  407. /// <param name="other">The collection to compare with.</param>
  408. public static void ExceptWith<T>(this ref NativeHashSet<T> container, NativeParallelHashSet<T> other)
  409. where T : unmanaged, IEquatable<T>
  410. {
  411. foreach (var item in other)
  412. {
  413. container.Remove(item);
  414. }
  415. }
  416. /// <summary>
  417. /// Removes the values from this set which are absent in another collection.
  418. /// </summary>
  419. /// <typeparam name="T">The type of values.</typeparam>
  420. /// <param name="container">The set to remove values from.</param>
  421. /// <param name="other">The collection to compare with.</param>
  422. public static void IntersectWith<T>(this ref NativeHashSet<T> container, NativeParallelHashSet<T> other)
  423. where T : unmanaged, IEquatable<T>
  424. {
  425. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  426. foreach (var item in other)
  427. {
  428. if (container.Contains(item))
  429. {
  430. result.Add(item);
  431. }
  432. }
  433. container.Clear();
  434. container.UnionWith(result);
  435. result.Dispose();
  436. }
  437. /// <summary>
  438. /// Adds all values from a collection to this set.
  439. /// </summary>
  440. /// <typeparam name="T">The type of values.</typeparam>
  441. /// <param name="container">The set to add values to.</param>
  442. /// <param name="other">The collection to copy values from.</param>
  443. public static void UnionWith<T>(this ref NativeHashSet<T> container, NativeParallelHashSet<T> other)
  444. where T : unmanaged, IEquatable<T>
  445. {
  446. foreach (var item in other)
  447. {
  448. container.Add(item);
  449. }
  450. }
  451. /// <summary>
  452. /// Removes the values from this set which are also present in another collection.
  453. /// </summary>
  454. /// <typeparam name="T">The type of values.</typeparam>
  455. /// <param name="container">The set to remove values from.</param>
  456. /// <param name="other">The collection to compare with.</param>
  457. public static void ExceptWith<T>(this ref NativeHashSet<T> container, NativeParallelHashSet<T>.ReadOnly other)
  458. where T : unmanaged, IEquatable<T>
  459. {
  460. foreach (var item in other)
  461. {
  462. container.Remove(item);
  463. }
  464. }
  465. /// <summary>
  466. /// Removes the values from this set which are absent in another collection.
  467. /// </summary>
  468. /// <typeparam name="T">The type of values.</typeparam>
  469. /// <param name="container">The set to remove values from.</param>
  470. /// <param name="other">The collection to compare with.</param>
  471. public static void IntersectWith<T>(this ref NativeHashSet<T> container, NativeParallelHashSet<T>.ReadOnly other)
  472. where T : unmanaged, IEquatable<T>
  473. {
  474. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  475. foreach (var item in other)
  476. {
  477. if (container.Contains(item))
  478. {
  479. result.Add(item);
  480. }
  481. }
  482. container.Clear();
  483. container.UnionWith(result);
  484. result.Dispose();
  485. }
  486. /// <summary>
  487. /// Adds all values from a collection to this set.
  488. /// </summary>
  489. /// <typeparam name="T">The type of values.</typeparam>
  490. /// <param name="container">The set to add values to.</param>
  491. /// <param name="other">The collection to copy values from.</param>
  492. public static void UnionWith<T>(this ref NativeHashSet<T> container, NativeParallelHashSet<T>.ReadOnly other)
  493. where T : unmanaged, IEquatable<T>
  494. {
  495. foreach (var item in other)
  496. {
  497. container.Add(item);
  498. }
  499. }
  500. /// <summary>
  501. /// Removes the values from this set which are also present in another collection.
  502. /// </summary>
  503. /// <typeparam name="T">The type of values.</typeparam>
  504. /// <param name="container">The set to remove values from.</param>
  505. /// <param name="other">The collection to compare with.</param>
  506. public static void ExceptWith<T>(this ref NativeHashSet<T> container, NativeList<T> other)
  507. where T : unmanaged, IEquatable<T>
  508. {
  509. foreach (var item in other)
  510. {
  511. container.Remove(item);
  512. }
  513. }
  514. /// <summary>
  515. /// Removes the values from this set which are absent in another collection.
  516. /// </summary>
  517. /// <typeparam name="T">The type of values.</typeparam>
  518. /// <param name="container">The set to remove values from.</param>
  519. /// <param name="other">The collection to compare with.</param>
  520. public static void IntersectWith<T>(this ref NativeHashSet<T> container, NativeList<T> other)
  521. where T : unmanaged, IEquatable<T>
  522. {
  523. var result = new UnsafeList<T>(container.Count, Allocator.Temp);
  524. foreach (var item in other)
  525. {
  526. if (container.Contains(item))
  527. {
  528. result.Add(item);
  529. }
  530. }
  531. container.Clear();
  532. container.UnionWith(result);
  533. result.Dispose();
  534. }
  535. /// <summary>
  536. /// Adds all values from a collection to this set.
  537. /// </summary>
  538. /// <typeparam name="T">The type of values.</typeparam>
  539. /// <param name="container">The set to add values to.</param>
  540. /// <param name="other">The collection to copy values from.</param>
  541. public static void UnionWith<T>(this ref NativeHashSet<T> container, NativeList<T> other)
  542. where T : unmanaged, IEquatable<T>
  543. {
  544. foreach (var item in other)
  545. {
  546. container.Add(item);
  547. }
  548. }
  549. /// <summary>
  550. /// Removes the values from this set which are also present in another collection.
  551. /// </summary>
  552. /// <typeparam name="T">The type of values.</typeparam>
  553. /// <param name="container">The set to remove values from.</param>
  554. /// <param name="other">The collection to compare with.</param>
  555. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, FixedList128Bytes<T> other)
  556. where T : unmanaged, IEquatable<T>
  557. {
  558. foreach (var item in other)
  559. {
  560. container.Remove(item);
  561. }
  562. }
  563. /// <summary>
  564. /// Removes the values from this set which are absent in another collection.
  565. /// </summary>
  566. /// <typeparam name="T">The type of values.</typeparam>
  567. /// <param name="container">The set to remove values from.</param>
  568. /// <param name="other">The collection to compare with.</param>
  569. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, FixedList128Bytes<T> other)
  570. where T : unmanaged, IEquatable<T>
  571. {
  572. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  573. foreach (var item in other)
  574. {
  575. if (container.Contains(item))
  576. {
  577. result.Add(item);
  578. }
  579. }
  580. container.Clear();
  581. container.UnionWith(result);
  582. result.Dispose();
  583. }
  584. /// <summary>
  585. /// Adds all values from a collection to this set.
  586. /// </summary>
  587. /// <typeparam name="T">The type of values.</typeparam>
  588. /// <param name="container">The set to add values to.</param>
  589. /// <param name="other">The collection to copy values from.</param>
  590. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, FixedList128Bytes<T> other)
  591. where T : unmanaged, IEquatable<T>
  592. {
  593. foreach (var item in other)
  594. {
  595. container.Add(item);
  596. }
  597. }
  598. /// <summary>
  599. /// Removes the values from this set which are also present in another collection.
  600. /// </summary>
  601. /// <typeparam name="T">The type of values.</typeparam>
  602. /// <param name="container">The set to remove values from.</param>
  603. /// <param name="other">The collection to compare with.</param>
  604. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, FixedList32Bytes<T> other)
  605. where T : unmanaged, IEquatable<T>
  606. {
  607. foreach (var item in other)
  608. {
  609. container.Remove(item);
  610. }
  611. }
  612. /// <summary>
  613. /// Removes the values from this set which are absent in another collection.
  614. /// </summary>
  615. /// <typeparam name="T">The type of values.</typeparam>
  616. /// <param name="container">The set to remove values from.</param>
  617. /// <param name="other">The collection to compare with.</param>
  618. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, FixedList32Bytes<T> other)
  619. where T : unmanaged, IEquatable<T>
  620. {
  621. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  622. foreach (var item in other)
  623. {
  624. if (container.Contains(item))
  625. {
  626. result.Add(item);
  627. }
  628. }
  629. container.Clear();
  630. container.UnionWith(result);
  631. result.Dispose();
  632. }
  633. /// <summary>
  634. /// Adds all values from a collection to this set.
  635. /// </summary>
  636. /// <typeparam name="T">The type of values.</typeparam>
  637. /// <param name="container">The set to add values to.</param>
  638. /// <param name="other">The collection to copy values from.</param>
  639. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, FixedList32Bytes<T> other)
  640. where T : unmanaged, IEquatable<T>
  641. {
  642. foreach (var item in other)
  643. {
  644. container.Add(item);
  645. }
  646. }
  647. /// <summary>
  648. /// Removes the values from this set which are also present in another collection.
  649. /// </summary>
  650. /// <typeparam name="T">The type of values.</typeparam>
  651. /// <param name="container">The set to remove values from.</param>
  652. /// <param name="other">The collection to compare with.</param>
  653. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, FixedList4096Bytes<T> other)
  654. where T : unmanaged, IEquatable<T>
  655. {
  656. foreach (var item in other)
  657. {
  658. container.Remove(item);
  659. }
  660. }
  661. /// <summary>
  662. /// Removes the values from this set which are absent in another collection.
  663. /// </summary>
  664. /// <typeparam name="T">The type of values.</typeparam>
  665. /// <param name="container">The set to remove values from.</param>
  666. /// <param name="other">The collection to compare with.</param>
  667. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, FixedList4096Bytes<T> other)
  668. where T : unmanaged, IEquatable<T>
  669. {
  670. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  671. foreach (var item in other)
  672. {
  673. if (container.Contains(item))
  674. {
  675. result.Add(item);
  676. }
  677. }
  678. container.Clear();
  679. container.UnionWith(result);
  680. result.Dispose();
  681. }
  682. /// <summary>
  683. /// Adds all values from a collection to this set.
  684. /// </summary>
  685. /// <typeparam name="T">The type of values.</typeparam>
  686. /// <param name="container">The set to add values to.</param>
  687. /// <param name="other">The collection to copy values from.</param>
  688. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, FixedList4096Bytes<T> other)
  689. where T : unmanaged, IEquatable<T>
  690. {
  691. foreach (var item in other)
  692. {
  693. container.Add(item);
  694. }
  695. }
  696. /// <summary>
  697. /// Removes the values from this set which are also present in another collection.
  698. /// </summary>
  699. /// <typeparam name="T">The type of values.</typeparam>
  700. /// <param name="container">The set to remove values from.</param>
  701. /// <param name="other">The collection to compare with.</param>
  702. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, FixedList512Bytes<T> other)
  703. where T : unmanaged, IEquatable<T>
  704. {
  705. foreach (var item in other)
  706. {
  707. container.Remove(item);
  708. }
  709. }
  710. /// <summary>
  711. /// Removes the values from this set which are absent in another collection.
  712. /// </summary>
  713. /// <typeparam name="T">The type of values.</typeparam>
  714. /// <param name="container">The set to remove values from.</param>
  715. /// <param name="other">The collection to compare with.</param>
  716. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, FixedList512Bytes<T> other)
  717. where T : unmanaged, IEquatable<T>
  718. {
  719. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  720. foreach (var item in other)
  721. {
  722. if (container.Contains(item))
  723. {
  724. result.Add(item);
  725. }
  726. }
  727. container.Clear();
  728. container.UnionWith(result);
  729. result.Dispose();
  730. }
  731. /// <summary>
  732. /// Adds all values from a collection to this set.
  733. /// </summary>
  734. /// <typeparam name="T">The type of values.</typeparam>
  735. /// <param name="container">The set to add values to.</param>
  736. /// <param name="other">The collection to copy values from.</param>
  737. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, FixedList512Bytes<T> other)
  738. where T : unmanaged, IEquatable<T>
  739. {
  740. foreach (var item in other)
  741. {
  742. container.Add(item);
  743. }
  744. }
  745. /// <summary>
  746. /// Removes the values from this set which are also present in another collection.
  747. /// </summary>
  748. /// <typeparam name="T">The type of values.</typeparam>
  749. /// <param name="container">The set to remove values from.</param>
  750. /// <param name="other">The collection to compare with.</param>
  751. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, FixedList64Bytes<T> other)
  752. where T : unmanaged, IEquatable<T>
  753. {
  754. foreach (var item in other)
  755. {
  756. container.Remove(item);
  757. }
  758. }
  759. /// <summary>
  760. /// Removes the values from this set which are absent in another collection.
  761. /// </summary>
  762. /// <typeparam name="T">The type of values.</typeparam>
  763. /// <param name="container">The set to remove values from.</param>
  764. /// <param name="other">The collection to compare with.</param>
  765. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, FixedList64Bytes<T> other)
  766. where T : unmanaged, IEquatable<T>
  767. {
  768. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  769. foreach (var item in other)
  770. {
  771. if (container.Contains(item))
  772. {
  773. result.Add(item);
  774. }
  775. }
  776. container.Clear();
  777. container.UnionWith(result);
  778. result.Dispose();
  779. }
  780. /// <summary>
  781. /// Adds all values from a collection to this set.
  782. /// </summary>
  783. /// <typeparam name="T">The type of values.</typeparam>
  784. /// <param name="container">The set to add values to.</param>
  785. /// <param name="other">The collection to copy values from.</param>
  786. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, FixedList64Bytes<T> other)
  787. where T : unmanaged, IEquatable<T>
  788. {
  789. foreach (var item in other)
  790. {
  791. container.Add(item);
  792. }
  793. }
  794. /// <summary>
  795. /// Removes the values from this set which are also present in another collection.
  796. /// </summary>
  797. /// <typeparam name="T">The type of values.</typeparam>
  798. /// <param name="container">The set to remove values from.</param>
  799. /// <param name="other">The collection to compare with.</param>
  800. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, NativeArray<T> other)
  801. where T : unmanaged, IEquatable<T>
  802. {
  803. foreach (var item in other)
  804. {
  805. container.Remove(item);
  806. }
  807. }
  808. /// <summary>
  809. /// Removes the values from this set which are absent in another collection.
  810. /// </summary>
  811. /// <typeparam name="T">The type of values.</typeparam>
  812. /// <param name="container">The set to remove values from.</param>
  813. /// <param name="other">The collection to compare with.</param>
  814. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, NativeArray<T> other)
  815. where T : unmanaged, IEquatable<T>
  816. {
  817. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  818. foreach (var item in other)
  819. {
  820. if (container.Contains(item))
  821. {
  822. result.Add(item);
  823. }
  824. }
  825. container.Clear();
  826. container.UnionWith(result);
  827. result.Dispose();
  828. }
  829. /// <summary>
  830. /// Adds all values from a collection to this set.
  831. /// </summary>
  832. /// <typeparam name="T">The type of values.</typeparam>
  833. /// <param name="container">The set to add values to.</param>
  834. /// <param name="other">The collection to copy values from.</param>
  835. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, NativeArray<T> other)
  836. where T : unmanaged, IEquatable<T>
  837. {
  838. foreach (var item in other)
  839. {
  840. container.Add(item);
  841. }
  842. }
  843. /// <summary>
  844. /// Removes the values from this set which are also present in another collection.
  845. /// </summary>
  846. /// <typeparam name="T">The type of values.</typeparam>
  847. /// <param name="container">The set to remove values from.</param>
  848. /// <param name="other">The collection to compare with.</param>
  849. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, NativeHashSet<T> other)
  850. where T : unmanaged, IEquatable<T>
  851. {
  852. foreach (var item in other)
  853. {
  854. container.Remove(item);
  855. }
  856. }
  857. /// <summary>
  858. /// Removes the values from this set which are absent in another collection.
  859. /// </summary>
  860. /// <typeparam name="T">The type of values.</typeparam>
  861. /// <param name="container">The set to remove values from.</param>
  862. /// <param name="other">The collection to compare with.</param>
  863. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, NativeHashSet<T> other)
  864. where T : unmanaged, IEquatable<T>
  865. {
  866. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  867. foreach (var item in other)
  868. {
  869. if (container.Contains(item))
  870. {
  871. result.Add(item);
  872. }
  873. }
  874. container.Clear();
  875. container.UnionWith(result);
  876. result.Dispose();
  877. }
  878. /// <summary>
  879. /// Adds all values from a collection to this set.
  880. /// </summary>
  881. /// <typeparam name="T">The type of values.</typeparam>
  882. /// <param name="container">The set to add values to.</param>
  883. /// <param name="other">The collection to copy values from.</param>
  884. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, NativeHashSet<T> other)
  885. where T : unmanaged, IEquatable<T>
  886. {
  887. foreach (var item in other)
  888. {
  889. container.Add(item);
  890. }
  891. }
  892. /// <summary>
  893. /// Removes the values from this set which are also present in another collection.
  894. /// </summary>
  895. /// <typeparam name="T">The type of values.</typeparam>
  896. /// <param name="container">The set to remove values from.</param>
  897. /// <param name="other">The collection to compare with.</param>
  898. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, NativeHashSet<T>.ReadOnly other)
  899. where T : unmanaged, IEquatable<T>
  900. {
  901. foreach (var item in other)
  902. {
  903. container.Remove(item);
  904. }
  905. }
  906. /// <summary>
  907. /// Removes the values from this set which are absent in another collection.
  908. /// </summary>
  909. /// <typeparam name="T">The type of values.</typeparam>
  910. /// <param name="container">The set to remove values from.</param>
  911. /// <param name="other">The collection to compare with.</param>
  912. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, NativeHashSet<T>.ReadOnly other)
  913. where T : unmanaged, IEquatable<T>
  914. {
  915. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  916. foreach (var item in other)
  917. {
  918. if (container.Contains(item))
  919. {
  920. result.Add(item);
  921. }
  922. }
  923. container.Clear();
  924. container.UnionWith(result);
  925. result.Dispose();
  926. }
  927. /// <summary>
  928. /// Adds all values from a collection to this set.
  929. /// </summary>
  930. /// <typeparam name="T">The type of values.</typeparam>
  931. /// <param name="container">The set to add values to.</param>
  932. /// <param name="other">The collection to copy values from.</param>
  933. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, NativeHashSet<T>.ReadOnly other)
  934. where T : unmanaged, IEquatable<T>
  935. {
  936. foreach (var item in other)
  937. {
  938. container.Add(item);
  939. }
  940. }
  941. /// <summary>
  942. /// Removes the values from this set which are also present in another collection.
  943. /// </summary>
  944. /// <typeparam name="T">The type of values.</typeparam>
  945. /// <param name="container">The set to remove values from.</param>
  946. /// <param name="other">The collection to compare with.</param>
  947. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, NativeParallelHashSet<T> other)
  948. where T : unmanaged, IEquatable<T>
  949. {
  950. foreach (var item in other)
  951. {
  952. container.Remove(item);
  953. }
  954. }
  955. /// <summary>
  956. /// Removes the values from this set which are absent in another collection.
  957. /// </summary>
  958. /// <typeparam name="T">The type of values.</typeparam>
  959. /// <param name="container">The set to remove values from.</param>
  960. /// <param name="other">The collection to compare with.</param>
  961. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, NativeParallelHashSet<T> other)
  962. where T : unmanaged, IEquatable<T>
  963. {
  964. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  965. foreach (var item in other)
  966. {
  967. if (container.Contains(item))
  968. {
  969. result.Add(item);
  970. }
  971. }
  972. container.Clear();
  973. container.UnionWith(result);
  974. result.Dispose();
  975. }
  976. /// <summary>
  977. /// Adds all values from a collection to this set.
  978. /// </summary>
  979. /// <typeparam name="T">The type of values.</typeparam>
  980. /// <param name="container">The set to add values to.</param>
  981. /// <param name="other">The collection to copy values from.</param>
  982. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, NativeParallelHashSet<T> other)
  983. where T : unmanaged, IEquatable<T>
  984. {
  985. foreach (var item in other)
  986. {
  987. container.Add(item);
  988. }
  989. }
  990. /// <summary>
  991. /// Removes the values from this set which are also present in another collection.
  992. /// </summary>
  993. /// <typeparam name="T">The type of values.</typeparam>
  994. /// <param name="container">The set to remove values from.</param>
  995. /// <param name="other">The collection to compare with.</param>
  996. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, NativeParallelHashSet<T>.ReadOnly other)
  997. where T : unmanaged, IEquatable<T>
  998. {
  999. foreach (var item in other)
  1000. {
  1001. container.Remove(item);
  1002. }
  1003. }
  1004. /// <summary>
  1005. /// Removes the values from this set which are absent in another collection.
  1006. /// </summary>
  1007. /// <typeparam name="T">The type of values.</typeparam>
  1008. /// <param name="container">The set to remove values from.</param>
  1009. /// <param name="other">The collection to compare with.</param>
  1010. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, NativeParallelHashSet<T>.ReadOnly other)
  1011. where T : unmanaged, IEquatable<T>
  1012. {
  1013. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1014. foreach (var item in other)
  1015. {
  1016. if (container.Contains(item))
  1017. {
  1018. result.Add(item);
  1019. }
  1020. }
  1021. container.Clear();
  1022. container.UnionWith(result);
  1023. result.Dispose();
  1024. }
  1025. /// <summary>
  1026. /// Adds all values from a collection to this set.
  1027. /// </summary>
  1028. /// <typeparam name="T">The type of values.</typeparam>
  1029. /// <param name="container">The set to add values to.</param>
  1030. /// <param name="other">The collection to copy values from.</param>
  1031. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, NativeParallelHashSet<T>.ReadOnly other)
  1032. where T : unmanaged, IEquatable<T>
  1033. {
  1034. foreach (var item in other)
  1035. {
  1036. container.Add(item);
  1037. }
  1038. }
  1039. /// <summary>
  1040. /// Removes the values from this set which are also present in another collection.
  1041. /// </summary>
  1042. /// <typeparam name="T">The type of values.</typeparam>
  1043. /// <param name="container">The set to remove values from.</param>
  1044. /// <param name="other">The collection to compare with.</param>
  1045. public static void ExceptWith<T>(this ref NativeParallelHashSet<T> container, NativeList<T> other)
  1046. where T : unmanaged, IEquatable<T>
  1047. {
  1048. foreach (var item in other)
  1049. {
  1050. container.Remove(item);
  1051. }
  1052. }
  1053. /// <summary>
  1054. /// Removes the values from this set which are absent in another collection.
  1055. /// </summary>
  1056. /// <typeparam name="T">The type of values.</typeparam>
  1057. /// <param name="container">The set to remove values from.</param>
  1058. /// <param name="other">The collection to compare with.</param>
  1059. public static void IntersectWith<T>(this ref NativeParallelHashSet<T> container, NativeList<T> other)
  1060. where T : unmanaged, IEquatable<T>
  1061. {
  1062. var result = new UnsafeList<T>(container.Count(), Allocator.Temp);
  1063. foreach (var item in other)
  1064. {
  1065. if (container.Contains(item))
  1066. {
  1067. result.Add(item);
  1068. }
  1069. }
  1070. container.Clear();
  1071. container.UnionWith(result);
  1072. result.Dispose();
  1073. }
  1074. /// <summary>
  1075. /// Adds all values from a collection to this set.
  1076. /// </summary>
  1077. /// <typeparam name="T">The type of values.</typeparam>
  1078. /// <param name="container">The set to add values to.</param>
  1079. /// <param name="other">The collection to copy values from.</param>
  1080. public static void UnionWith<T>(this ref NativeParallelHashSet<T> container, NativeList<T> other)
  1081. where T : unmanaged, IEquatable<T>
  1082. {
  1083. foreach (var item in other)
  1084. {
  1085. container.Add(item);
  1086. }
  1087. }
  1088. }
  1089. }