8#ifndef INCLUDED_BSLH_HASHTUPLE
9#define INCLUDED_BSLH_HASHTUPLE
96#include <bslscm_version.h>
100#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_TUPLE
104#include <type_traits>
115template <std::
size_t BACK_INDEX,
class HASH_ALGORITHM,
class TUPLE_TYPE>
127 static void visit(HASH_ALGORITHM& algorithm,
const TUPLE_TYPE& input);
132template <
class HASH_ALGORITHM,
class TUPLE_TYPE>
133struct hashTuple_Util<0, HASH_ALGORITHM, TUPLE_TYPE>
141 static void visit(HASH_ALGORITHM& algorithm,
const TUPLE_TYPE& input);
149template <
class HASH_ALGORITHM,
class ... TYPE>
150void hashAppend(HASH_ALGORITHM& algorithm,
const std::tuple<TYPE ...> &input);
160template <std::
size_t BACK_INDEX,
class HASH_ALGORITHM,
class TUPLE_TYPE>
162void hashTuple_Util<BACK_INDEX, HASH_ALGORITHM, TUPLE_TYPE>::visit(
163 HASH_ALGORITHM& algorithm,
164 const TUPLE_TYPE& input)
168 const std::size_t tupleSize = std::tuple_size<TUPLE_TYPE>::value;
169 const std::size_t index = tupleSize - BACK_INDEX;
171 hashAppend(algorithm, std::get<index>(input));
175 const std::size_t nextBackIndex = BACK_INDEX - 1;
177 hashTuple_Util<nextBackIndex, HASH_ALGORITHM, TUPLE_TYPE>::visit(algorithm,
181template <
class HASH_ALGORITHM,
class TUPLE_TYPE>
183void hashTuple_Util<0, HASH_ALGORITHM, TUPLE_TYPE>::visit(HASH_ALGORITHM& ,
189template <
class HASH_ALGORITHM,
class ... TYPE>
192hashAppend(HASH_ALGORITHM& algorithm,
const std::tuple<TYPE ...> &input)
194 using TupleType =
typename std::remove_reference<
decltype(input)>::type;
196 const std::size_t tupleSize = std::tuple_size<TupleType>::value;
198 if (0 == tupleSize) {
202 hashTuple_Util<tupleSize, HASH_ALGORITHM, TupleType>::visit(algorithm,
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
bsl::invoke_result< t_VISITOR &, typenamebsl::variant_alternative< 0, t_VARIANT >::type & >::type visit(t_VISITOR &visitor, t_VARIANT &variant)
Definition bslstl_variant.h:2262
Definition bslh_defaulthashalgorithm.h:339
bsl::enable_if<(bsl::is_integral< TYPE >::value||bsl::is_pointer< TYPE >::value||bsl::is_enum< TYPE >::value)&&!bsl::is_same< TYPE, bool >::value >::type hashAppend(HASH_ALGORITHM &hashAlg, TYPE input)
Definition bslh_hash.h:638