di 0.1.0
Loading...
Searching...
No Matches
hash_same.h
Go to the documentation of this file.
1#pragma once
2
7#include "di/meta/algorithm.h"
8#include "di/meta/core.h"
9#include "di/meta/language.h"
10#include "di/types/prelude.h"
14
15namespace di::container {
16namespace detail {
17 struct HashSameFunction {
18 template<typename T, typename U>
19 constexpr auto operator()(InPlaceType<T>, InPlaceType<U>) const -> bool {
20 return concepts::SameAs<T, U>;
21 }
22
23 template<concepts::IntegralOrEnum T, concepts::IntegralOrEnum U>
24 requires(!concepts::TagInvocable<HashWriteFunction, DefaultHasher&, T> &&
25 !concepts::TagInvocable<HashWriteFunction, DefaultHasher&, U>)
26 constexpr auto operator()(InPlaceType<T>, InPlaceType<U>) const -> bool {
27 return sizeof(T) == sizeof(U);
28 }
29
30 template<typename T, typename U>
31 requires(concepts::TagInvocableTo<HashSameFunction, bool, InPlaceType<T>, InPlaceType<U>>)
32 constexpr auto operator()(InPlaceType<T>, InPlaceType<U>) const -> bool {
34 }
35 };
36}
37
38constexpr inline auto hash_same = detail::HashSameFunction {};
39}
40
41namespace di::concepts {
42template<typename T, typename U>
45}
46
47namespace di::container::detail {
48template<HashableContainer T, HashableContainer U>
51}
52
53template<concepts::TupleLike T, concepts::TupleLike U>
54requires((meta::TupleSize<T> == meta::TupleSize<U>) && !HashableContainer<T> && !HashableContainer<U>)
57 [&]<usize... indices>(meta::ListV<indices...>) {
59 });
60}
61}
62
63namespace di {
65}
Definition hash_same.h:43
Definition hash_write.h:48
Definition any_storable.h:9
Definition sequence.h:12
constexpr auto hash_same
Definition hash_same.h:38
constexpr tag_invoke_detail::TagInvokeFn tag_invoke
Definition tag_invoke.h:22
constexpr auto unpack
Definition unpack.h:24
constexpr auto TupleSize
Definition tuple_size.h:23
RemoveCV< RemoveReference< T > > RemoveCVRef
Definition core.h:74
IteratorReference< ContainerIterator< T > > ContainerReference
Definition container_reference.h:8
decltype(vocab::tuple_element(types::in_place_type< meta::RemoveReference< T > >, c_< index >))::Type TupleElement
Definition tuple_element.h:21
size_t usize
Definition integers.h:33
di::meta::Decay< decltype(T)> Tag
Definition tag_invoke.h:28
Definition any_storable.h:9
constexpr tag_invoke_detail::TagInvokeFn tag_invoke
Definition tag_invoke.h:22
constexpr auto in_place_type
Definition in_place_type.h:12
Definition core.h:8
Definition in_place_type.h:5