microfmt
Zero-allocation C++ formatting for constrained environments
Loading...
Searching...
No Matches
Classes | Namespaces | Functions | Variables
hash.hpp File Reference

`std::hash`-based non-owning hash formatting views. More...

#include "../microfmt.hpp"
#include <cstddef>
#include <functional>
#include <type_traits>
Include dependency graph for hash.hpp:

Go to the source code of this file.

Classes

struct  microfmt::detail::is_hashable< T, typename >
 SFINAE trait detecting types invocable through std::hash<T>. More...
 
struct  microfmt::detail::is_hashable< T, std::void_t< decltype(std::hash< T >{}(std::declval< const T & >()))> >
 Specialization enabling is_hashable when std::hash<T> is callable. More...
 
class  microfmt::hash_view< T >
 Non-owning view that defers a value's hash computation to formatting time. More...
 
struct  microfmt::formatter< hash_view< T > >
 Formatter for hash_view. More...
 

Namespaces

namespace  microfmt
 
namespace  microfmt::detail
 

Functions

template<typename T , std::enable_if_t< detail::is_hashable_v< T >, int > = 0>
constexpr auto microfmt::as_hash (const T &val RELOCO_LIFETIMEBOUND) noexcept
 Wraps a value in an hash_view for hashed formatting.
 
template<typename T , std::enable_if_t< !std::is_lvalue_reference_v< T > &&detail::is_hashable_v< std::remove_reference_t< T > >, int > = 0>
constexpr auto microfmt::as_hash (T &&) noexcept=delete
 

Variables

template<typename T >
constexpr bool microfmt::detail::is_hashable_v = is_hashable<T>::value
 Convenience variable template for is_hashable.
 

Detailed Description

`std::hash`-based non-owning hash formatting views.