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  Pair() {}
14  : first(f)
15  , second(s)
16  {}
17  Pair(const std::pair< FirstType, SecondType >& p)
18  : first(p.first)
19  , second(p.second)
20  {}
22  const std::pair< FirstType, SecondType >& p)
23  {
24  first = p.first;
25  second = p.second;
26  }
29  };
30 
31  template< class FirstT >
32  struct Pair< FirstT, FirstT >
33  {
34  typedef FirstT FirstType;
37  Pair() {}
39  : first(f)
40  , second(s)
41  {}
42  Pair(std::pair< FirstType, SecondType >& p)
43  : first(p.first)
44  , second(p.second)
45  {}
47  const std::pair< FirstType, SecondType >& p)
48  {
49  first = p.first;
50  second = p.second;
51  }
52  operator FirstType* ()
53  {
54  return &first;
55  }
56  operator const FirstType* () const
57  {
58  return &first;
59  }
60  };
61 
62  template< class FirstT, class SecondT >
63  Pair< FirstT, SecondT > MakePair(FirstT& first, SecondT& second)
64  {
65  return Pair< FirstT, SecondT >(first, second);
66  }
67 };
68 
69 #endif
MiscLib::Pair< FirstT, FirstT >::SecondType
FirstType SecondType
Definition: Pair.h:35
MiscLib::Pair
Definition: Pair.h:8
MiscLib::Pair< FirstT, FirstT >::Pair
Pair(FirstType &f, SecondType &s)
Definition: Pair.h:38
MiscLib::MakePair
Pair< FirstT, SecondT > MakePair(FirstT &first, SecondT &second)
Definition: Pair.h:63
MiscLib::Pair::SecondType
SecondT SecondType
Definition: Pair.h:11
MiscLib::Pair< FirstT, FirstT >::operator=
Pair< FirstType, SecondType > & operator=(const std::pair< FirstType, SecondType > &p)
Definition: Pair.h:46
MiscLib::Pair::Pair
Pair()
Definition: Pair.h:12
MiscLib
Definition: AlignedAllocator.h:11
MiscLib::Pair< FirstT, FirstT >::Pair
Pair()
Definition: Pair.h:37
MiscLib::Pair::operator=
Pair< FirstType, SecondType > & operator=(const std::pair< FirstType, SecondType > &p)
Definition: Pair.h:21
MiscLib::Pair::first
FirstType first
Definition: Pair.h:27
MiscLib::Pair< FirstT, FirstT >::second
FirstType second
Definition: Pair.h:36
MiscLib::Pair::second
SecondType second
Definition: Pair.h:28
MiscLib::Pair< FirstT, FirstT >::FirstType
FirstT FirstType
Definition: Pair.h:34
MiscLib::Pair< FirstT, FirstT >::Pair
Pair(std::pair< FirstType, SecondType > &p)
Definition: Pair.h:42
MiscLib::Pair::Pair
Pair(FirstType &f, SecondType &s)
Definition: Pair.h:13
MiscLib::Pair::Pair
Pair(const std::pair< FirstType, SecondType > &p)
Definition: Pair.h:17
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