aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include/span.h
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2021-01-24 07:42:57 +0000
committerLee Clagett <code@leeclagett.com>2021-01-23 06:23:39 +0000
commit08e4497c6e3b3f434c0bb255c3942648f153fe66 (patch)
tree2564f4214e9e66b2dc03ce3c788bb080b963be56 /contrib/epee/include/span.h
parentMerge pull request #7669 (diff)
downloadmonero-08e4497c6e3b3f434c0bb255c3942648f153fe66.tar.xz
Improve cryptonote (block and tx) binary read performance
Diffstat (limited to '')
-rw-r--r--contrib/epee/include/span.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/epee/include/span.h b/contrib/epee/include/span.h
index b355c960a..26861f994 100644
--- a/contrib/epee/include/span.h
+++ b/contrib/epee/include/span.h
@@ -31,7 +31,6 @@
#include <algorithm>
#include <cstdint>
#include <memory>
-#include <string>
#include <type_traits>
namespace epee
@@ -167,10 +166,11 @@ namespace epee
}
//! make a span from a std::string
- template<typename T>
- span<const T> strspan(const std::string &s) noexcept
+ template<typename T, typename U>
+ span<const T> strspan(const U&s) noexcept
{
- static_assert(std::is_same<T, char>() || std::is_same<T, unsigned char>() || std::is_same<T, int8_t>() || std::is_same<T, uint8_t>(), "Unexpected type");
+ static_assert(std::is_same<typename U::value_type, char>(), "unexpected source type");
+ static_assert(std::is_same<T, char>() || std::is_same<T, unsigned char>() || std::is_same<T, int8_t>() || std::is_same<T, uint8_t>(), "Unexpected destination type");
return {reinterpret_cast<const T*>(s.data()), s.size()};
}
}