Chromium Code Reviews| Index: mojo/common/common_type_converters.h |
| diff --git a/mojo/common/common_type_converters.h b/mojo/common/common_type_converters.h |
| index a065f050791d71a72d11cf9f88e648019839a31c..ac6c0c9e483cfbed95f8ff4c269632d1f91af444 100644 |
| --- a/mojo/common/common_type_converters.h |
| +++ b/mojo/common/common_type_converters.h |
| @@ -6,6 +6,7 @@ |
| #define MOJO_COMMON_COMMON_TYPE_CONVERTERS_H_ |
| #include <stdint.h> |
| +#include <vector> |
| #include "base/strings/string16.h" |
| #include "base/strings/string_piece.h" |
| @@ -61,6 +62,17 @@ struct MOJO_COMMON_EXPORT TypeConverter<Array<uint8_t>, base::string16> { |
| static Array<uint8_t> Convert(const base::string16& input); |
| }; |
| +template <typename A, typename B> |
| +struct TypeConverter<std::vector<A>, std::vector<B>> { |
| + static std::vector<A> Convert(const std::vector<B>& input) { |
| + std::vector<A> result; |
| + result.reserve(input.size()); |
| + for (const B& item : input) |
| + result.push_back(mojo::ConvertTo<A>(item)); |
| + return result; |
| + }; |
| +}; |
|
dcheng
2016/08/15 18:18:15
Actually, let's not add this type converter please
Reilly Grant (use Gerrit)
2016/08/15 21:39:02
As discussed OOB I've moved this to a more private
|
| + |
| } // namespace mojo |
| #endif // MOJO_COMMON_COMMON_TYPE_CONVERTERS_H_ |