Jpp 21.0.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JTOOLS::JMultiPair< N, JKey_t, JValue_t > Class Template Reference

Multidimensional pair. More...

#include <JMultiPair.hh>

Public Types

typedef JKey_t key_type
 
typedef JValue_t value_type
 
typedef JMultiPair< N-1, key_type, value_typemapped_type
 
typedef JLANG::JClass< value_type >::reference_type reference_type
 
typedef JMultiKey< N, key_typemultikey_type
 

Public Member Functions

 JMultiPair ()
 Default constructor.
 
 JMultiPair (typename JClass< mapped_type >::argument_type first, typename JClass< key_type > ::argument_type second)
 Append constructor.
 
 JMultiPair (typename JClass< key_type > ::argument_type first, typename JClass< mapped_type >::argument_type second)
 Insert constructor.
 
 JMultiPair (typename JClass< key_type >::argument_type first, const JMultiPair &second)
 Shift constructor.
 
 JMultiPair (typename JClass< multikey_type >::argument_type key, typename JClass< value_type > ::argument_type value)
 Constructor.
 
multikey_type getKey () const
 Get multidimensional key.
 
reference_type getValue ()
 Get value.
 
const reference_type getValue () const
 Get value.
 

Public Attributes

key_type first
 
mapped_type second
 

Detailed Description

template<unsigned int N, class JKey_t, class JValue_t>
class JTOOLS::JMultiPair< N, JKey_t, JValue_t >

Multidimensional pair.

This class reproduces the element of a multidimensional map. The individual data members can be accessed as:

          JMultiPair<3, key_type, mapped_type>  pair;

          pair[[.second].second].first;
          pair[[.second].second].second;

Definition at line 30 of file JMultiPair.hh.

Member Typedef Documentation

◆ key_type

template<unsigned int N, class JKey_t , class JValue_t >
JKey_t JTOOLS::JMultiPair< N, JKey_t, JValue_t >::key_type

Definition at line 34 of file JMultiPair.hh.

◆ value_type

template<unsigned int N, class JKey_t , class JValue_t >
JValue_t JTOOLS::JMultiPair< N, JKey_t, JValue_t >::value_type

Definition at line 35 of file JMultiPair.hh.

◆ mapped_type

template<unsigned int N, class JKey_t , class JValue_t >
JMultiPair<N-1, key_type, value_type> JTOOLS::JMultiPair< N, JKey_t, JValue_t >::mapped_type

Definition at line 36 of file JMultiPair.hh.

◆ reference_type

template<unsigned int N, class JKey_t , class JValue_t >
JLANG::JClass<value_type>::reference_type JTOOLS::JMultiPair< N, JKey_t, JValue_t >::reference_type

Definition at line 37 of file JMultiPair.hh.

◆ multikey_type

template<unsigned int N, class JKey_t , class JValue_t >
JMultiKey<N, key_type> JTOOLS::JMultiPair< N, JKey_t, JValue_t >::multikey_type

Definition at line 38 of file JMultiPair.hh.

Constructor & Destructor Documentation

◆ JMultiPair() [1/5]

template<unsigned int N, class JKey_t , class JValue_t >
JTOOLS::JMultiPair< N, JKey_t, JValue_t >::JMultiPair ( )
inline

Default constructor.

Definition at line 44 of file JMultiPair.hh.

44 :
45 first (),
46 second()
47 {}
mapped_type second

◆ JMultiPair() [2/5]

template<unsigned int N, class JKey_t , class JValue_t >
JTOOLS::JMultiPair< N, JKey_t, JValue_t >::JMultiPair ( typename JClass< mapped_type >::argument_type first,
typename JClass< key_type > ::argument_type second )
inline

Append constructor.

The secondary key is appended to the end of the primary keys.

Parameters
firstprimary keys and value
secondsecondary key

Definition at line 57 of file JMultiPair.hh.

58 :
59 first (first.first),
61 {}
JMultiPair< N-1, key_type, value_type > mapped_type
Definition JMultiPair.hh:36

◆ JMultiPair() [3/5]

template<unsigned int N, class JKey_t , class JValue_t >
JTOOLS::JMultiPair< N, JKey_t, JValue_t >::JMultiPair ( typename JClass< key_type > ::argument_type first,
typename JClass< mapped_type >::argument_type second )
inline

Insert constructor.

The primary key is inserted at the start of the secondary keys.

Parameters
firstprimary key
secondsecondary keys and value

Definition at line 71 of file JMultiPair.hh.

72 :
73 first (first),
75 {}

◆ JMultiPair() [4/5]

template<unsigned int N, class JKey_t , class JValue_t >
JTOOLS::JMultiPair< N, JKey_t, JValue_t >::JMultiPair ( typename JClass< key_type >::argument_type first,
const JMultiPair< N, JKey_t, JValue_t > & second )
inline

Shift constructor.

The first of the secondary keys is removed and the primary key is inserted in the remainder of the primary keys.

Parameters
firstprimary key
secondsecondary keys and value

Definition at line 85 of file JMultiPair.hh.

85 :
86 first (first),
88 {}

◆ JMultiPair() [5/5]

template<unsigned int N, class JKey_t , class JValue_t >
JTOOLS::JMultiPair< N, JKey_t, JValue_t >::JMultiPair ( typename JClass< multikey_type >::argument_type key,
typename JClass< value_type > ::argument_type value )
inline

Constructor.

Parameters
keymultidimensional key
valuevalue

Definition at line 97 of file JMultiPair.hh.

98 :
99 first (key.first),
100 second(mapped_type(key.second, value))
101 {}

Member Function Documentation

◆ getKey()

template<unsigned int N, class JKey_t , class JValue_t >
multikey_type JTOOLS::JMultiPair< N, JKey_t, JValue_t >::getKey ( ) const
inline

Get multidimensional key.

Returns
multidimensional key

Definition at line 109 of file JMultiPair.hh.

110 {
111 return multikey_type(this->first, this->second.getKey());
112 }
multikey_type getKey() const
Get multidimensional key.
JMultiKey< N, key_type > multikey_type
Definition JMultiPair.hh:38

◆ getValue() [1/2]

template<unsigned int N, class JKey_t , class JValue_t >
reference_type JTOOLS::JMultiPair< N, JKey_t, JValue_t >::getValue ( )
inline

Get value.

Returns
value

Definition at line 120 of file JMultiPair.hh.

121 {
122 return this->second.getValue();
123 }
reference_type getValue()
Get value.

◆ getValue() [2/2]

template<unsigned int N, class JKey_t , class JValue_t >
const reference_type JTOOLS::JMultiPair< N, JKey_t, JValue_t >::getValue ( ) const
inline

Get value.

Returns
value

Definition at line 131 of file JMultiPair.hh.

132 {
133 return this->second.getValue();
134 }

Member Data Documentation

◆ first

template<unsigned int N, class JKey_t , class JValue_t >
key_type JTOOLS::JMultiPair< N, JKey_t, JValue_t >::first

Definition at line 137 of file JMultiPair.hh.

◆ second

template<unsigned int N, class JKey_t , class JValue_t >
mapped_type JTOOLS::JMultiPair< N, JKey_t, JValue_t >::second

Definition at line 138 of file JMultiPair.hh.


The documentation for this class was generated from the following file: