25#ifndef LSST_AFW_TYPEHANDLING_KEY_H
26#define LSST_AFW_TYPEHANDLING_KEY_H
33#include "boost/core/demangle.hpp"
51template <
typename K,
typename V>
68 constexpr explicit Key(K
id) : id(id) {}
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());
172template <
typename V,
typename K>
195template <
typename K,
typename V>
197 static const std::string typeStr = boost::core::demangle(
typeid(V).name());
200 os << key.
getId() <<
"<" << typeStr << constStr << volatileStr <<
">";
209template <
typename K,
typename V>
210struct hash<typename
lsst::afw::typehandling::Key<K, V>> {
Key for type-safe lookup in a GenericMap.
constexpr Key< K, V > makeKey(K const &id)
Factory function for Key, to enable type parameter inference.
constexpr bool operator<(Key< K, U > const &other) const noexcept
Define sort order for Keys.
Key(Key< K, U > other)
Convert a key to a different key that could retrieve the same values.
std::ostream & operator<<(std::ostream &os, Key< K, V > const &key)
Output operator for Key.
constexpr bool operator==(Key< K, V > const &other) const noexcept
Test for key equality.
Key & operator=(Key &&)=default
Key & operator=(Key const &)=default
constexpr bool operator!=(Key< K, U > const &other) const noexcept
Test for key equality.
constexpr std::enable_if_t<!std::is_same< U, V >::value, bool > operator==(Key< K, U > const &) const noexcept
Test for key equality.
std::size_t hash_value() const noexcept
Return a hash of this object.
constexpr Key(K id)
Construct a new key.
constexpr std::string const & getId() const noexcept
constexpr bool IS_SMART_PTR
size_t operator()(argument_type const &obj) const noexcept
typename lsst::afw::typehandling::Key< K, V > argument_type