aboutsummaryrefslogtreecommitdiff
path: root/zencore/include
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-10-29 19:21:33 +0200
committerStefan Boberg <[email protected]>2021-10-29 19:21:41 +0200
commit73a5bec027b5879a9870b156d85343c8a018fe1e (patch)
tree2be926bb314bc95bcf950b05a699c2cc96a79243 /zencore/include
parentcas: minor improvement to CasLogFile::Open error handling (diff)
parentMinor cleanup (diff)
downloadzen-73a5bec027b5879a9870b156d85343c8a018fe1e.tar.xz
zen-73a5bec027b5879a9870b156d85343c8a018fe1e.zip
Merged from main
Diffstat (limited to 'zencore/include')
-rw-r--r--zencore/include/zencore/sharedbuffer.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/zencore/include/zencore/sharedbuffer.h b/zencore/include/zencore/sharedbuffer.h
index 640c3fe74..1f87dc639 100644
--- a/zencore/include/zencore/sharedbuffer.h
+++ b/zencore/include/zencore/sharedbuffer.h
@@ -143,6 +143,12 @@ public:
/** Make a non-owned view of the input */
[[nodiscard]] inline static SharedBuffer MakeView(MemoryView View) { return MakeView(View.GetData(), View.GetSize()); }
+ /** Make a non-owning view of the memory of the contiguous container. */
+ [[nodiscard]] inline static SharedBuffer MakeView(const std::ranges::contiguous_range auto& Container)
+ {
+ std::span Span = Container;
+ return MakeView(Span.data(), Span.size() * sizeof(typename decltype(Span)::element_type));
+ }
/** Make a non-owned view of the input */
[[nodiscard]] ZENCORE_API static SharedBuffer MakeView(const void* Data, uint64_t Size);
/** Make a non-owned view of the input */