From 30ae14fae9ca2d2a2aaa185395c75e615518af87 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 12 Dec 2017 18:40:28 +0200 Subject: [PATCH] B3DImporter: Add unique_to_array helper function --- code/B3DImporter.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/code/B3DImporter.cpp b/code/B3DImporter.cpp index bc888fb66..46008bf31 100644 --- a/code/B3DImporter.cpp +++ b/code/B3DImporter.cpp @@ -267,6 +267,21 @@ T *B3DImporter::to_array( const vector &v ){ return p; } + +// ------------------------------------------------------------------------------------------------ +template +T **unique_to_array( vector > &v ){ + if( v.empty() ) { + return 0; + } + T **p = new T*[ v.size() ]; + for( size_t i = 0; i < v.size(); ++i ){ + p[i] = v[i].release(); + } + return p; +} + + // ------------------------------------------------------------------------------------------------ void B3DImporter::ReadTEXS(){ while( ChunkSize() ){