mn_triple.hpp
Go to the documentation of this file.
1 
18 #ifndef _MINILIB_96612aaf_c4c6_4113_b496_477cb506a2b8_H_
19 #define _MINILIB_96612aaf_c4c6_4113_b496_477cb506a2b8_H_
20 
21 #include "../mn_typetraits.hpp"
22 
23 
24 namespace mn {
25 
26  namespace container {
27 
28  template <typename TFIRST, typename TSECOND, typename TTHIRD>
29  struct basic_triple {
30  using first_type = TFIRST;
31  using pointer_first = TFIRST*;
32  using reference_first = TFIRST&;
33 
34  using second_type = TSECOND;
35  using pointer_second = TSECOND*;
36  using reference_second = TSECOND&;
37 
38  using third_type = TTHIRD;
39  using pointer_third = TTHIRD*;
40  using reference_third = TTHIRD&;
41 
43 
45 
46  explicit basic_triple(const reference_first a)
47  : first(a) { }
49  : first(a), second(b), third(c) { }
50 
51  basic_triple(const self_type& other)
52  : first(other.first), second(other.second), third(other.third) { }
53 
54  void swap(const self_type& other) {
55  self_type _temp(this);
56  other = this;
57  this = _temp;
58  }
60  first = rhs.first;
61  second = rhs.second;
62  third = rhs.third;
63  return *this;
64  }
65 
66  bool operator == (const self_type& rhs) {
67  if(first != rhs.first) return false;
68  return second == rhs.second;
69  }
70  bool operator != (const self_type& rhs) {
71  if(first == rhs.first) return false;
72  return second != rhs.second;
73  }
74 
75 
79  };
80 
81  template<typename TFIRST, typename TSECOND, typename TTHIRD>
83 
84  template<typename TFIRST, typename TSECOND, typename TTHIRD>
85  triple<TFIRST, TSECOND, TTHIRD> make_triple(const TFIRST& a, const TSECOND& b, const TTHIRD& c) {
86  return triple<TFIRST, TSECOND>(a, b, c);
87  }
88  }
89  template<typename TFIRST, typename TSECOND, typename TTHIRD>
90  struct is_pod< container::triple<TFIRST, TSECOND, TTHIRD> > {
91  enum {
95  };
96  };
97 }
98 
99 #endif
triple< TFIRST, TSECOND, TTHIRD > make_triple(const TFIRST &a, const TSECOND &b, const TTHIRD &c)
Definition: mn_triple.hpp:85
basic_triple< TFIRST, TSECOND, TTHIRD > triple
Definition: mn_triple.hpp:82
Definition: mn_allocator_typetraits.hpp:25
Definition: mn_triple.hpp:29
basic_triple()
Definition: mn_triple.hpp:44
TFIRST first_type
Definition: mn_triple.hpp:30
bool operator!=(const self_type &rhs)
Definition: mn_triple.hpp:70
first_type first
Definition: mn_triple.hpp:76
basic_triple(const self_type &other)
Definition: mn_triple.hpp:51
third_type third
Definition: mn_triple.hpp:78
basic_triple(const reference_first a)
Definition: mn_triple.hpp:46
TTHIRD * pointer_third
Definition: mn_triple.hpp:39
TSECOND & reference_second
Definition: mn_triple.hpp:36
self_type & operator=(const self_type &rhs)
Definition: mn_triple.hpp:59
TFIRST & reference_first
Definition: mn_triple.hpp:32
TSECOND * pointer_second
Definition: mn_triple.hpp:35
TFIRST * pointer_first
Definition: mn_triple.hpp:31
basic_triple(const reference_first a, reference_second b, reference_third c)
Definition: mn_triple.hpp:48
TTHIRD third_type
Definition: mn_triple.hpp:38
bool operator==(const self_type &rhs)
Definition: mn_triple.hpp:66
TTHIRD & reference_third
Definition: mn_triple.hpp:40
second_type second
Definition: mn_triple.hpp:77
TSECOND second_type
Definition: mn_triple.hpp:34
void swap(const self_type &other)
Definition: mn_triple.hpp:54
@ value
Definition: mn_typetraits.hpp:126
Definition: mn_typetraits.hpp:357
Definition: mn_typetraits.hpp:249