lsst.afw
20.0.0-4-gde602ef96+5
|
Go to the documentation of this file.
25 #ifndef LSST_AFW_TYPEHANDLING_KEY_H
26 #define LSST_AFW_TYPEHANDLING_KEY_H
31 #include <type_traits>
33 #include "boost/core/demangle.hpp"
39 namespace typehandling {
51 template <
typename K,
typename V>
90 static_assert((!detail::IS_SMART_PTR<U> && !detail::IS_SMART_PTR<V> &&
92 (detail::IS_SMART_PTR<U> && detail::IS_SMART_PTR<V> &&
94 "Implicit conversion of Keys whose types are not implicitly convertible.");
105 constexpr K
const&
getId() const noexcept {
return id; }
117 template <
typename U>
118 constexpr std::enable_if_t<!std::is_same<U, V>::value,
bool>
operator==(
Key<K, U> const&)
const noexcept {
122 template <
typename U>
124 return !(*
this ==
other);
142 template <
typename U>
145 return comparator(this->
getId(),
other.getId());
172 template <
typename V,
typename K>
195 template <
typename K,
typename V>
197 static const std::string typeStr = boost::core::demangle(
typeid(V).
name());
200 os <<
key.getId() <<
"<" << typeStr << constStr << volatileStr <<
">";
209 template <
typename K,
typename V>
210 struct hash<typename
lsst::afw::typehandling::Key<K, V>> {
typename lsst::afw::typehandling::Key< K, V > argument_type
constexpr bool operator<(Key< K, U > const &other) const noexcept
Define sort order for Keys.
constexpr Key< K, V > makeKey(K const &id)
Factory function for Key, to enable type parameter inference.
constexpr Key(K id)
Construct a new key.
Key & operator=(Key const &)=default
Key(Key< K, U > other)
Convert a key to a different key that could retrieve the same values.
ItemVariant const * other
A base class for image defects.
Key for type-safe lookup in a GenericMap.
std::ostream & operator<<(std::ostream &os, Key< K, V > const &key)
Output operator for Key.
size_t operator()(argument_type const &obj) const noexcept
constexpr bool operator==(Key< K, V > const &other) const noexcept
Test for key equality.
constexpr bool operator!=(Key< K, U > const &other) const noexcept
Test for key equality.
constexpr K const & getId() const noexcept
Return the identifier of this field.
Key & operator=(Key &&)=default
std::size_t hash_value() const noexcept
Return a hash of this object.