Commit 576c7e13 authored by Joe Mason's avatar Joe Mason Committed by Commit Bot

Mojo: Add ArrayTraits for std::unordered_set

This is required to typemap chrome_cleaner::PUPData.

R=rockot

Bug: 830892
Change-Id: I42e29dbd928c1bd9064ba9a75a37493461209b7e
Reviewed-on: https://chromium-review.googlesource.com/1171736
Commit-Queue: Joe Mason <joenotcharles@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582416}
parent 8e4127dd
......@@ -13,6 +13,29 @@
namespace mojo {
template <typename T>
struct ArrayTraits<std::unordered_set<T>> {
using Element = T;
using ConstIterator = typename std::unordered_set<T>::const_iterator;
static bool IsNull(const std::unordered_set<T>& input) {
// std::unordered_set<> is always converted to non-null mojom array.
return false;
}
static size_t GetSize(const std::unordered_set<T>& input) {
return input.size();
}
static ConstIterator GetBegin(const std::unordered_set<T>& input) {
return input.begin();
}
static void AdvanceIterator(ConstIterator& iterator) { ++iterator; }
static const T& GetValue(ConstIterator& iterator) { return *iterator; }
};
template <typename T>
struct ArrayTraits<std::vector<T>> {
using Element = T;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment