|
lsst.afw g4f4f280218+81551fceaa
|
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 |
|
inlineexplicitconstexpr |
|
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 |
|
inlineconstexprnoexcept |
Return the identifier of this field.
The identifier serves as the "key" for the map abstraction represented by GenericMap.
|
inlinenoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
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.
|
default |
|
default |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
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 |
osK is exception-safe.