Skip to content

Commit

Permalink
Merge pull request #11 from barakwei/master
Browse files Browse the repository at this point in the history
Initializer list support for vector and map.
  • Loading branch information
mike-matera committed Jul 18, 2017
2 parents 5700530 + 226aa59 commit 5db9224
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/map
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <utility>
#include <iterator>
#include <associative_base>
#include <initializer_list>


#ifndef __STD_HEADER_MAP
Expand Down Expand Up @@ -109,6 +110,10 @@ public:
const Compare& comp = Compare(), const Allocator& al = Allocator())
: base(first, last, comp, al, v_t_k) { }

map(initializer_list<pair<Key, T>> in, const Compare& comp = Compare(),
const Allocator& al = Allocator())
: base(in.begin(), in.end(), comp, al, v_t_k) { }

map(const map<Key,T,Compare,Allocator>& x) : base(x) { }
~map() { }

Expand Down
5 changes: 5 additions & 0 deletions src/vector
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ namespace std{
resize(n, u);
}

_UCXXEXPORT void assign(initializer_list<value_type> in){
clear();
insert(begin(), in.begin(), in.end());
}

inline allocator_type get_allocator() const{
return a;
}
Expand Down

0 comments on commit 5db9224

Please sign in to comment.