Samchon Framework for CPP  1.0.0
IndexPair.hpp
1 #pragma once
2 #include <utility>
3 
4 namespace samchon
5 {
28  template<class T>
29  class IndexPair
30  : public std::pair<size_t, T>
31  {
32  private:
33  typedef std::pair<size_t, T> super;
34 
35  public:
36  /* -----------------------------------------------------------
37  CONSTRUCTORS
38  ----------------------------------------------------------- */
39  //using super::super;
40 
45  : super()
46  {
47  };
48 
52  template<class U> IndexPair(const IndexPair<U> &obj)
53  : super(obj)
54  {
55  };
56 
60  template<class U> IndexPair(const IndexPair<U> &&obj)
61  : super(obj)
62  {
63  };
64 
68  IndexPair(size_t index, const T &val)
69  : super(index, val)
70  {
71  };
72 
73  /* -----------------------------------------------------------
74  GETTERS
75  ----------------------------------------------------------- */
81  auto getIndex() const -> size_t
82  {
83  return first;
84  };
85 
91  auto getValue() -> T&
92  {
93  return second;
94  };
95 
101  auto getValue() const -> const T&
102  {
103  return second;
104  };
105  };
106 };
IndexPair()
Default Constructor.
Definition: IndexPair.hpp:44
IndexPair(const IndexPair< U > &&obj)
Move Constructor.
Definition: IndexPair.hpp:60
auto getValue() -> T &
Get reference of value.
Definition: IndexPair.hpp:91
IndexPair(size_t index, const T &val)
Construct from members.
Definition: IndexPair.hpp:68
IndexPair(const IndexPair< U > &obj)
Copy Constructor.
Definition: IndexPair.hpp:52
auto getIndex() const -> size_t
Get index.
Definition: IndexPair.hpp:81
A pair of index and its value(T)
Definition: IndexPair.hpp:29
auto getValue() const -> const T &
Get const reference of const value.
Definition: IndexPair.hpp:101
Top level namespace of products built from samchon.
Definition: ByteArray.hpp:7