Arduino Libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
pair.hpp
Go to the documentation of this file.
1 // Author: Mario S. Könz <mskoenz@gmx.net>
2 // Date: 13.09.2013 20:26:47 CEST
3 // File: pair.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 __PAIR_HEADER
12 #define __PAIR_HEADER
13 
14 namespace ustd {
15  template<typename T, typename U>
16  struct pair {
17  typedef T first_type;
18  typedef U second_type;
19 
20  //------------------- ctors -------------------
21  pair(): first(), second() {
22  }
23  pair(T const & f, U const & s): first(f), second(s) {
24  }
25 
26  //------------------- data -------------------
29 
30  //------------------- print and serialize -------------------
31  template<typename S>
32  void print(S & os) const {
33  os << F("[") << first << F(", ") << second << F("]");
34  }
35  template<typename Archive>
36  void serialize(Archive & ar) {
37  ar & first;
38  ar & second;
39  }
40  };
41 
42  template<typename T, typename U>
43  pair<T, U> make_pair(T const & t, U const & u) {
44  return pair<T, U>(t, u);
45  }
46 }//end namespace ustd
47 
48 #endif //__PAIR_HEADER
Definition: pair.hpp:16
pair()
Definition: pair.hpp:21
void print(S &os) const
Definition: pair.hpp:32
void serialize(Archive &ar)
Definition: pair.hpp:36
second_type second
Definition: pair.hpp:28
T first_type
Definition: pair.hpp:17
U second_type
Definition: pair.hpp:18
pair(T const &f, U const &s)
Definition: pair.hpp:23
#define F(x)
Definition: ustd_generic.hpp:15
pair< T, U > make_pair(T const &t, U const &u)
Definition: pair.hpp:43
first_type first
Definition: pair.hpp:27