Arduino Libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
array_support.hpp
Go to the documentation of this file.
1 // Author: Mario S. Könz <mskoenz@gmx.net>
2 // Date: 15.06.2013 23:34:04 EDT
3 // File: array_support.hpp
4 
5 /* This program is free software. It comes without any warranty, to
6  * the extent permitted by applicable law. You can redistribute it
7  * and/or modify it under the terms of the Do What The Fuck You Want
8  * To Public License, Version 2, as published by Sam Hocevar. See
9  * http://www.wtfpl.net/ or COPYING for more details. */
10 
11 #ifndef __ARRAY_SUPPORT_HEADER
12 #define __ARRAY_SUPPORT_HEADER
13 
14 #include <array>
15 
16 //------------------- print & serialize -------------------
17 template<typename T, size_t N, typename S>
18 S & operator<<(S & os, std::array<T, N> const & arg) {
19  os << "[";
20  for(size_t i = 0; i < N; ++i) {
21  os << arg[i];
22  if(i != N - 1)
23  os << ", ";
24  }
25  os << "]";
26  return os;
27 }
28 namespace com {
29  template<typename T, size_t N, typename Archive>
30  void serialize(Archive & ar, std::array<T, N> & arg) {
31  for(size_t i = 0; i < N; ++i) {
32  ar & arg[i];
33  }
34  }
35 }//end namespace com
36 
37 #endif //__ARRAY_SUPPORT_HEADER
void serialize(Archive &ar, T &t)
Definition: serializer.hpp:95