B3DImporter: Add unique_to_array helper function

pull/1635/head
Turo Lamminen 2017-12-12 18:40:28 +02:00
parent 949375e695
commit 30ae14fae9
1 changed files with 15 additions and 0 deletions

View File

@ -267,6 +267,21 @@ T *B3DImporter::to_array( const vector<T> &v ){
return p; return p;
} }
// ------------------------------------------------------------------------------------------------
template<class T>
T **unique_to_array( vector<std::unique_ptr<T> > &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(){ void B3DImporter::ReadTEXS(){
while( ChunkSize() ){ while( ChunkSize() ){