Implement iterator-based assign() in pointer verion of MVKSmallVectorImpl.
diff --git a/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm b/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm
index 15f8daa..a0aa4cb 100644
--- a/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm
+++ b/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm
@@ -297,9 +297,7 @@
_isRenderingEntireAttachment = (mvkVkOffset2DsAreEqual(_renderArea.offset, {0,0}) &&
mvkVkExtent2DsAreEqual(_renderArea.extent, _framebufferExtent));
_clearValues.assign(clearValues.begin(), clearValues.end());
- for(auto* v : attachments) {
- _attachments.push_back(v);
- }
+ _attachments.assign(attachments.begin(), attachments.end());
setSubpass(passCmd, subpassContents, 0);
}
@@ -339,7 +337,7 @@
endCurrentMetalEncoding();
MTLRenderPassDescriptor* mtlRPDesc = [MTLRenderPassDescriptor renderPassDescriptor];
- getSubpass()->populateMTLRenderPassDescriptor(mtlRPDesc,
+ getSubpass()->populateMTLRenderPassDescriptor(mtlRPDesc,
_multiviewPassIndex,
_framebufferExtent,
_framebufferLayerCount,
diff --git a/MoltenVK/MoltenVK/Utility/MVKSmallVector.h b/MoltenVK/MoltenVK/Utility/MVKSmallVector.h
index 4648d19..e20e7fa 100755
--- a/MoltenVK/MoltenVK/Utility/MVKSmallVector.h
+++ b/MoltenVK/MoltenVK/Utility/MVKSmallVector.h
@@ -781,6 +781,18 @@
alc.num_elements_used = new_size;
}
+ template <class InputIterator>
+ void assign( InputIterator first, InputIterator last )
+ {
+ clear();
+
+ while( first != last )
+ {
+ push_back( *first );
+ ++first;
+ }
+ }
+
void resize( const size_t new_size, const Type *t = nullptr )
{
if ( new_size == alc.num_elements_used )