Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Stroika::Foundation::Common::KeyValuePair< KEY_TYPE, VALUE_TYPE > Struct Template Reference

#include <KeyValuePair.h>

Inheritance diagram for Stroika::Foundation::Common::KeyValuePair< KEY_TYPE, VALUE_TYPE >:
Stroika::Foundation::IO::Network::HTTP::Cookie

Public Member Functions

constexpr KeyValuePair ()=default
 
constexpr bool operator== (const KeyValuePair &) const
 
constexpr auto operator<=> (const KeyValuePair &) const
 

Detailed Description

template<typename KEY_TYPE, typename VALUE_TYPE>
struct Stroika::Foundation::Common::KeyValuePair< KEY_TYPE, VALUE_TYPE >

Essentially the same as pair<KEY_TYPE,VALUE_TYPE> but with more clearly named data elements (when used for mappings, or other key/value pairs).

Note
moderately interoperable with pair<>
Supports KeyValuePair<T,void> - so second type maybe void (sometimes useful as degenerate case - e.g. SkipList)
Comparisons: o static_assert (totally_ordered<KEY_TYPE> and totally_ordered<VALUE_TYPE> IMPLIES totally_ordered<KeyValuePair<...>>)

Definition at line 35 of file KeyValuePair.h.

Constructor & Destructor Documentation

◆ KeyValuePair()

template<typename KEY_TYPE , typename VALUE_TYPE >
constexpr Stroika::Foundation::Common::KeyValuePair< KEY_TYPE, VALUE_TYPE >::KeyValuePair ( )
constexprdefault

Similar logic for what overloads are available to pair<>, but here we also allow construction from a 'pair<>'.

Member Function Documentation

◆ operator==()

template<typename KEY_TYPE , typename VALUE_TYPE >
requires (equality_comparable<KEY_TYPE> and equality_comparable<VALUE_TYPE>)
constexpr bool Stroika::Foundation::Common::KeyValuePair< KEY_TYPE, VALUE_TYPE >::operator== ( const KeyValuePair< KEY_TYPE, VALUE_TYPE > &  rhs) const
constexpr

Define operator== in the obvious way key == key and value == value. This method is only defined if BOTH the key and value have a defined operator==

Definition at line 78 of file KeyValuePair.inl.

◆ operator<=>()

template<typename KEY_TYPE , typename VALUE_TYPE >
requires (three_way_comparable<KEY_TYPE> and three_way_comparable<VALUE_TYPE>)
constexpr auto Stroika::Foundation::Common::KeyValuePair< KEY_TYPE, VALUE_TYPE >::operator<=> ( const KeyValuePair< KEY_TYPE, VALUE_TYPE > &  rhs) const
constexpr

Define operator<=> in the obvious way key <=> key first, and then if equal, compare values. This method is only defined if BOTH the key and value have a defined spaceship operator

Definition at line 72 of file KeyValuePair.inl.


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