| 39 | |
| 40 | template <class K, class V> |
| 41 | static ::Platform::Collections::Map<K, V> ^ |
| 42 | JsArrayToWinrtMap( |
| 43 | v8::Local<v8::Array> arr, |
| 44 | const std::function<bool(v8::Local<v8::Value>)>& checkKeyTypeFunc, |
| 45 | const std::function<K(v8::Local<v8::Value>)>& convertToKeyTypeFunc, |
| 46 | const std::function<bool(v8::Local<v8::Value>)>& checkValueTypeFunc, |
| 47 | const std::function<V(v8::Local<v8::Value>)>& convertToValueTypeFunc) { |
| 48 | std::map<K, V> stdMap; |
| 49 | if (!FillMapFromJsArray(arr, checkKeyTypeFunc, convertToKeyTypeFunc, |
| 50 | checkValueTypeFunc, convertToValueTypeFunc, |
| 51 | stdMap)) { |
| 52 | return nullptr; |
| 53 | } |
| 54 | |
| 55 | // TODO: michfa: consider using std::move (here & everywhere), e.g: return |
| 56 | // ref new ::Platform::Collections::Map<K, V>(std::move(stdMap)); |
| 57 | // std::move will give a more efficient initialization from std::map, will |
| 58 | // invalidate stdMap however- some types will throw while moving |
| 59 | return ref new ::Platform::Collections::Map<K, V>(stdMap); |
| 60 | } |
| 61 | |
| 62 | template <class K, class V> |
| 63 | static ::Platform::Collections::MapView<K, V> ^ |
nothing calls this directly
no test coverage detected