LSSTApplications
18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
LSSTDataManagementBasePackage
|
Key for type-safe lookup in a GenericMap. More...
#include <Key.h>
Public Types | |
using | KeyType = K |
using | ValueType = V |
Public Member Functions | |
constexpr | Key (K id) |
Construct a new key. More... | |
Key (Key const &)=default | |
Key (Key &&)=default | |
Key & | operator= (Key const &)=default |
Key & | operator= (Key &&)=default |
template<typename U > | |
Key (Key< K, U > other) | |
Convert a key to a different key that could retrieve the same values. More... | |
constexpr K const & | getId () const noexcept |
Return the identifier of this field. More... | |
template<typename U > | |
constexpr bool | operator< (Key< K, U > const &other) const noexcept |
Define sort order for Keys. More... | |
std::size_t | hash_value () const noexcept |
Return a hash of this object. More... | |
constexpr bool | operator== (Key< K, V > const &other) const noexcept |
Test for key equality. More... | |
template<typename U > | |
constexpr std::enable_if_t<!std::is_same< U, V >::value, bool > | operator== (Key< K, U > const &) const noexcept |
Test for key equality. More... | |
template<typename U > | |
constexpr bool | operator!= (Key< K, U > const &other) const noexcept |
Test for key equality. More... | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename V , typename K > | |
constexpr Key< K, V > | makeKey (K const &id) |
Factory function for Key, to enable type parameter inference. More... | |
template<typename K , typename V > | |
std::ostream & | operator<< (std::ostream &os, Key< K, V > const &key) |
Output operator for Key. More... | |
Key for type-safe lookup in a GenericMap.
K | the logical type of the key (e.g., a string) |
V | the type of the value mapped to this key |
Key objects are equality-comparable, hashable, sortable, or printable if and only if K
is comparable, hashable, sortable, or printable, respectively. Key can be used in compile-time expressions if and only if K
can (in particular, Key<std::string, V>
cannot).
using lsst::afw::typehandling::Key< K, V >::KeyType = K |
using lsst::afw::typehandling::Key< K, V >::ValueType = V |
|
inlineexplicit |
|
default |
|
default |
|
inline |
Convert a key to a different key that could retrieve the same values.
U | The value type being converted from. Smart pointer keys are convertible if and only if the corresponding pointers are; other keys are convertible if and only if their value references are (consistent with pointers being retrieved by value and other types by reference). |
other |
Definition at line 89 of file Key.h.
|
inlinenoexcept |
Return the identifier of this field.
The identifier serves as the "key" for the map abstraction represented by GenericMap.
Definition at line 105 of file Key.h.
|
inlinenoexcept |
|
inlinenoexcept |
Test for key equality.
A key is considered equal to another key if and only if their getId() are equal and their value types are exactly the same (including const/volatile qualifications).
|
inlinenoexcept |
Define sort order for Keys.
This must be expressed as operator<
instead of std::less because only std::less<void> supports arguments of mixed types, and it cannot be specialized.
other | the key, possibly of a different type, to compare to |
this->getId() < other.getId()
K
does, but is not consistent with equality. In particular, keys with the same value of getId()
but different types will be equivalent but not equal. Definition at line 143 of file Key.h.
|
default |
|
default |
|
inlinenoexcept |
|
inlinenoexcept |
|
related |
Factory function for Key, to enable type parameter inference.
id | the key ID to create. |
K
.Calling this function prevents you from having to explicitly name the key type:
auto key = makeKey<int>("foo");
|
related |
Output operator for Key.
The output will use C++ template notation for the key; for example, a key "foo" pointing to an int
may print as "foo<int>"
.
os | the desired output stream |
key | the key to print |
os
K
is exception-safe.Definition at line 196 of file Key.h.