rippled
Loading...
Searching...
No Matches
strHex.h
1#pragma once
2
3#include <boost/algorithm/hex.hpp>
4#include <boost/endian/conversion.hpp>
5
6namespace xrpl {
7
8template <class FwdIt>
10strHex(FwdIt begin, FwdIt end)
11{
12 static_assert(
16 "FwdIt must be a forward iterator");
17 std::string result;
18 result.reserve(2 * std::distance(begin, end));
19 boost::algorithm::hex(begin, end, std::back_inserter(result));
20 return result;
21}
22
23template <class T, class = decltype(std::declval<T>().begin())>
25strHex(T const& from)
26{
27 return strHex(from.begin(), from.end());
28}
29
30} // namespace xrpl
T back_inserter(T... args)
T begin(T... args)
T distance(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
std::string strHex(FwdIt begin, FwdIt end)
Definition strHex.h:10
T reserve(T... args)