Pair.h
Go to the documentation of this file.
1 #ifndef MiscLib__PAIR_HEADER__
2 #define MiscLib__PAIR_HEADER__
3 #include <utility>
4 
5 namespace MiscLib
6 {
7  template <class FirstT, class SecondT>
8  struct Pair
9  {
10  typedef FirstT FirstType;
11  typedef SecondT SecondType;
12 
13  Pair()
14  {
15  }
16 
18  {
19  }
20 
21  Pair(const std::pair<FirstType, SecondType>& p) : first(p.first), second(p.second)
22  {
23  }
24 
26  operator=(const std::pair<FirstType, SecondType>& p)
27  {
28  first = p.first;
29  second = p.second;
30  }
31 
34  };
35 
36  template <class FirstT>
37  struct Pair<FirstT, FirstT>
38  {
39  typedef FirstT FirstType;
42 
43  Pair()
44  {
45  }
46 
48  {
49  }
50 
51  Pair(std::pair<FirstType, SecondType>& p) : first(p.first), second(p.second)
52  {
53  }
54 
56  operator=(const std::pair<FirstType, SecondType>& p)
57  {
58  first = p.first;
59  second = p.second;
60  }
61 
62  operator FirstType*()
63  {
64  return &first;
65  }
66 
67  operator const FirstType*() const
68  {
69  return &first;
70  }
71  };
72 
73  template <class FirstT, class SecondT>
74  Pair<FirstT, SecondT>
75  MakePair(FirstT& first, SecondT& second)
76  {
77  return Pair<FirstT, SecondT>(first, second);
78  }
79 }; // namespace MiscLib
80 
81 #endif
MiscLib::Pair::operator=
Pair< FirstType, SecondType > & operator=(const std::pair< FirstType, SecondType > &p)
Definition: Pair.h:26
MiscLib::Pair< FirstT, FirstT >::SecondType
FirstType SecondType
Definition: Pair.h:40
MiscLib::Pair
Definition: Pair.h:8
MiscLib::Pair< FirstT, FirstT >::Pair
Pair(FirstType &f, SecondType &s)
Definition: Pair.h:47
MiscLib::Pair< FirstT, FirstT >::operator=
Pair< FirstType, SecondType > & operator=(const std::pair< FirstType, SecondType > &p)
Definition: Pair.h:56
MiscLib::Pair::SecondType
SecondT SecondType
Definition: Pair.h:11
MiscLib::Pair::Pair
Pair()
Definition: Pair.h:13
MiscLib
Definition: AlignedAllocator.h:12
MiscLib::Pair< FirstT, FirstT >::Pair
Pair()
Definition: Pair.h:43
MiscLib::Pair::first
FirstType first
Definition: Pair.h:32
MiscLib::Pair< FirstT, FirstT >::second
FirstType second
Definition: Pair.h:41
MiscLib::Pair::second
SecondType second
Definition: Pair.h:33
MiscLib::Pair< FirstT, FirstT >::FirstType
FirstT FirstType
Definition: Pair.h:39
MiscLib::Pair< FirstT, FirstT >::Pair
Pair(std::pair< FirstType, SecondType > &p)
Definition: Pair.h:51
MiscLib::Pair::Pair
Pair(FirstType &f, SecondType &s)
Definition: Pair.h:17
MiscLib::MakePair
Pair< FirstT, SecondT > MakePair(FirstT &first, SecondT &second)
Definition: Pair.h:75
MiscLib::Pair::Pair
Pair(const std::pair< FirstType, SecondType > &p)
Definition: Pair.h:21
MiscLib::Pair::FirstType
FirstT FirstType
Definition: Pair.h:10
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33