summaryrefslogtreecommitdiff
path: root/libcult/cult/containers/pair.hxx
blob: b8b75063d7a44058ea7f576b11106e1360dad3d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// file      : cult/containers/pair.hxx
// author    : Boris Kolpackov <boris@kolpackov.net>
// copyright : Copyright (c) 2005-2010 Boris Kolpackov
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#ifndef CULT_CONTAINERS_PAIR_HXX
#define CULT_CONTAINERS_PAIR_HXX

#include <utility>

namespace Cult
{
  namespace Containers
  {
    template <typename T1, typename T2>
    class Pair: public std::pair<T1, T2>
    {
      typedef std::pair<T1, T2> Base;

      Base&
      base ()
      {
        return *this;
      }

    public:
      typedef T1 First;
      typedef T2 Second;

    public:
      Pair ()
          : Base ()
      {
      }

      Pair (First const& first, Second const& second)
          : Base (first, second)
      {
      }

      template <typename X, typename Y>
      Pair (std::pair<X, Y> const& pair)
          : Base (pair)
      {
      }

      template <typename X, typename Y>
      Pair&
      operator= (std::pair<X, Y> const& pair)
      {
        base () = pair;
        return *this;
      }
    };
  }
}

#endif  // CULT_CONTAINERS_PAIR_HXX