xtd 0.2.0
Loading...
Searching...
No Matches
xtd::collections::generic::key_value_pair< key_t, value_t > Struct Template Reference
Inheritance diagram for xtd::collections::generic::key_value_pair< key_t, value_t >:
xtd::object xtd::iequatable< key_value_pair< key_t, value_t > > xtd::interface xtd::extensions::equality_operators< type_t, equatable_t >

Definition

template<class key_t, class value_t>
struct xtd::collections::generic::key_value_pair< key_t, value_t >

Defines a key/value pair that can be set or retrieved.

template<class key_t, class value_t>
struct key_value_pair : xtd::object, xtd::iequatable<key_value_pair<key_t, value_t>>;
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:43
Defines a key/value pair that can be set or retrieved.
Definition key_value_pair.hpp:37
Header
#include <xtd/collections/generic/key_value_pair>
Namespace
xtd::collections::generic
Library
xtd.core
Remarks
xtd::collections::generic::key_value_pair is same as std::pair.

Public Aliases

using base_type = std::pair< key_t, value_t >
 Represents the type of the base.
 
using key_type = key_t
 Represents the type of the key.
 
using value_type = value_t
 Representd the type of the value.
 
using first_type = key_type
 Represents the type of the first.
 
using second_type = value_type
 Represents the type of the second.
 

Public Properties

key_t first
 Gets or sets the key in the key/value pair.
 
value_t second
 Gets or sets the value in the key/value pair.
 
const key_t & key () const noexcept
 Gets the key in the key/value pair.
 
const value_t & value () const noexcept
 Gets the value in the key/value pair.
 

Public Constructors

 key_value_pair ()=default
 Initializes a new instance of the key_value_pair<key_t, value_t> class with the default key and value.
 
 key_value_pair (const key_t &key, const value_t &value)
 Initializes a new instance of the key_value_pair<key_t, value_t> class with the specified key and value.
 
 key_value_pair (const std::pair< key_t, value_t > &value)
 Initializes a new instance of the key_value_pair<key_t, value_t> class with the specified key and value.
 
template<class... args1_t, class... args2_t>
 key_value_pair (std::piecewise_construct_t, std::tuple< args1_t... > first_args, std::tuple< args2_t... > second_args)
 Initializes a new instance of the key_value_pair<key_t, value_t> class with the specified first_args and second_args.
 

Public Methods

bool equals (const object &obj) const noexcept override
 Determines whether the specified object is equal to the current object.
 
bool equals (const key_value_pair &value) const noexcept override
 Determines whether the specified object is equal to the current object.
 
xtd::string to_string () const noexcept override
 Returns a String representation of the key_value_pair<key_t, value_t>, using the String representations of the key and value.
 

Public Operators

 operator std::pair< key_t, value_t > () const noexcept
 Converts the current key_value_pair to a std::pair.
 

Additional Inherited Members

- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual xtd::size get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<class object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
- Public Member Functions inherited from xtd::iequatable< key_value_pair< key_t, value_t > >
virtual bool equals (const key_value_pair< key_t, value_t > &) const noexcept=0
 Indicates whether the current object is equal to another object of the same type.
 
- Static Public Member Functions inherited from xtd::object
template<class object_a_t , class object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<class object_a_t , class object_b_t >
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

Member Typedef Documentation

◆ base_type

template<class key_t , class value_t >
using xtd::collections::generic::key_value_pair< key_t, value_t >::base_type = std::pair<key_t, value_t>

Represents the type of the base.

◆ key_type

template<class key_t , class value_t >
using xtd::collections::generic::key_value_pair< key_t, value_t >::key_type = key_t

Represents the type of the key.

◆ value_type

template<class key_t , class value_t >
using xtd::collections::generic::key_value_pair< key_t, value_t >::value_type = value_t

Representd the type of the value.

◆ first_type

template<class key_t , class value_t >
using xtd::collections::generic::key_value_pair< key_t, value_t >::first_type = key_type

Represents the type of the first.

◆ second_type

template<class key_t , class value_t >
using xtd::collections::generic::key_value_pair< key_t, value_t >::second_type = value_type

Represents the type of the second.

Constructor & Destructor Documentation

◆ key_value_pair() [1/4]

template<class key_t , class value_t >
xtd::collections::generic::key_value_pair< key_t, value_t >::key_value_pair ( )
default

Initializes a new instance of the key_value_pair<key_t, value_t> class with the default key and value.

◆ key_value_pair() [2/4]

template<class key_t , class value_t >
xtd::collections::generic::key_value_pair< key_t, value_t >::key_value_pair ( const key_t &  key,
const value_t &  value 
)
inline

Initializes a new instance of the key_value_pair<key_t, value_t> class with the specified key and value.

Parameters
KeyThe object defined in each key/value pair
valueThe definition associated with key

◆ key_value_pair() [3/4]

template<class key_t , class value_t >
xtd::collections::generic::key_value_pair< key_t, value_t >::key_value_pair ( const std::pair< key_t, value_t > &  value)
inline

Initializes a new instance of the key_value_pair<key_t, value_t> class with the specified key and value.

Parameters
valueThe key and value of the key_value_pair<key_t, value_t>.

◆ key_value_pair() [4/4]

template<class key_t , class value_t >
template<class... args1_t, class... args2_t>
xtd::collections::generic::key_value_pair< key_t, value_t >::key_value_pair ( std::piecewise_construct_t  ,
std::tuple< args1_t... >  first_args,
std::tuple< args2_t... >  second_args 
)
inline

Initializes a new instance of the key_value_pair<key_t, value_t> class with the specified first_args and second_args.

Parameters
first_argsThe tuple of constructor arguments to initialize the first element of this key_value_pair.
second_argsThe tuple of constructor arguments to initialize the second element of this key_value_pair.

Member Function Documentation

◆ key()

template<class key_t , class value_t >
const key_t & xtd::collections::generic::key_value_pair< key_t, value_t >::key ( ) const
inlinenoexcept

Gets the key in the key/value pair.

Returns
key_t A key_t that is the key of the key_value_pair<key_t, value_t>.

◆ value()

template<class key_t , class value_t >
const value_t & xtd::collections::generic::key_value_pair< key_t, value_t >::value ( ) const
inlinenoexcept

Gets the value in the key/value pair.

Returns
value_t A value_t that is the value of the key_value_pair<key_t, value_t>.

◆ equals() [1/2]

template<class key_t , class value_t >
bool xtd::collections::generic::key_value_pair< key_t, value_t >::equals ( const object obj) const
inlineoverridevirtualnoexcept

Determines whether the specified object is equal to the current object.

Parameters
objThe object to compare with the current object.
Returns
true if the specified object is equal to the current object; otherwise, false

Reimplemented from xtd::object.

◆ equals() [2/2]

template<class key_t , class value_t >
bool xtd::collections::generic::key_value_pair< key_t, value_t >::equals ( const key_value_pair< key_t, value_t > &  value) const
inlineoverridenoexcept

Determines whether the specified object is equal to the current object.

Parameters
valueThe key_value_pair to compare with the current object.
Returns
true if the specified object is equal to the current object; otherwise, false.

◆ to_string()

template<class key_t , class value_t >
xtd::string xtd::collections::generic::key_value_pair< key_t, value_t >::to_string ( ) const
overridevirtualnoexcept

Returns a String representation of the key_value_pair<key_t, value_t>, using the String representations of the key and value.

Returns
const String A String representation of the key_value_pair<key_t, value_t>, which includes the String representations of the key and value.
String

Reimplemented from xtd::object.

◆ operator std::pair< key_t, value_t >()

template<class key_t , class value_t >
xtd::collections::generic::key_value_pair< key_t, value_t >::operator std::pair< key_t, value_t > ( ) const
inlinenoexcept

Converts the current key_value_pair to a std::pair.

Returns
A std::pair that is the current key_value_pair<key_t, value_t>.

Member Data Documentation

◆ first

template<class key_t , class value_t >
key_t xtd::collections::generic::key_value_pair< key_t, value_t >::first

Gets or sets the key in the key/value pair.

◆ second

template<class key_t , class value_t >
value_t xtd::collections::generic::key_value_pair< key_t, value_t >::second

Gets or sets the value in the key/value pair.


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