Skip to content

Commit

Permalink
Add capability to initialize idList with initializer_list
Browse files Browse the repository at this point in the history
  • Loading branch information
MadDeCoDeR committed Dec 29, 2022
1 parent 5262af7 commit 3cdd931
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions neo/idlib/containers/List.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class idList

idList( int newgranularity = 16 );
idList( const idList& other );
idList(std::initializer_list<_type_> list);
~idList();

void Clear(); // clear the list
Expand Down Expand Up @@ -236,6 +237,25 @@ ID_INLINE idList<_type_, _tag_>::idList( const idList& other )
*this = other;
}

//GK: Begin
/*
================
idList<_type_,_tag_>::idList( std::initializer_list<_type_> other )
================
*/
template< typename _type_, memTag_t _tag_ >
ID_INLINE idList<_type_, _tag_>::idList(std::initializer_list<_type_> other)
{
list = NULL;
granularity = other.size();
memTag = _tag_;
Clear();
for (const _type_* i = other.begin(); i != other.end(); ++i) {
Append(*i);
}
}
//GK: End

/*
================
idList<_type_,_tag_>::~idList< _type_, _tag_ >
Expand Down

0 comments on commit 3cdd931

Please sign in to comment.