Chromium Code Reviews| Index: ipc/ipc_message_utils.h |
| diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h |
| index 8a03069c432890c3e7ef1413b2399db7a84d62c2..91af78701ddd6c7893ad9a8aa90b30835ef5421e 100644 |
| --- a/ipc/ipc_message_utils.h |
| +++ b/ipc/ipc_message_utils.h |
| @@ -497,6 +497,37 @@ struct ParamTraits<std::vector<char> > { |
| } |
| }; |
| +template <> |
| +struct ParamTraits<std::vector<bool> > { |
|
jam
2011/09/27 16:51:34
why do you need this? i.e. why isn't the traits be
Bernhard Bauer
2011/09/27 21:21:39
std::vector has a specialization for bool which us
jam
2011/09/29 01:03:32
what paramtraits below are you talking about?
Bernhard Bauer
2011/09/29 13:20:47
ParamTraits<std::vector<P> > takes the address of
jam
2011/09/29 16:31:10
ah, nm now i get it. I was familiar with vector's
|
| + typedef std::vector<bool> param_type; |
| + static void Write(Message* m, const param_type& p) { |
| + WriteParam(m, static_cast<int>(p.size())); |
| + for (size_t i = 0; i < p.size(); i++) |
| + WriteParam(m, p[i]); |
| + } |
| + static bool Read(const Message* m, void** iter, param_type* r) { |
| + int size; |
| + // ReadLength() checks for < 0 itself. |
| + if (!m->ReadLength(iter, &size)) |
| + return false; |
| + r->resize(size); |
| + for (int i = 0; i < size; i++) { |
| + bool value; |
| + if (!ReadParam(m, iter, &value)) |
| + return false; |
| + (*r)[i] = value; |
| + } |
| + return true; |
| + } |
| + static void Log(const param_type& p, std::string* l) { |
| + for (size_t i = 0; i < p.size(); ++i) { |
| + if (i != 0) |
| + l->append(" "); |
| + LogParam((p[i]), l); |
| + } |
| + } |
| +}; |
| + |
| template <class P> |
| struct ParamTraits<std::vector<P> > { |
| typedef std::vector<P> param_type; |