diff --git a/README.md b/README.md index 30790c1..8f40c30 100644 --- a/README.md +++ b/README.md @@ -285,6 +285,7 @@ For faster parallel builds, you can instead generate [ninja](https://ninja-build - Types - [ ] Result - [ ] Map: don't store hashes of integer keys + - [ ] Opt: specializations for null representations - Allocators - [ ] Per-thread pools - Misc diff --git a/rpp/slice.h b/rpp/slice.h index e65d3c3..5d093bb 100644 --- a/rpp/slice.h +++ b/rpp/slice.h @@ -45,6 +45,12 @@ struct Slice { length_ = init.size(); } + operator Slice() const noexcept + requires(!Const) + { + return Slice{data_, length_}; + } + constexpr Slice(const Slice& src) noexcept = default; constexpr Slice& operator=(const Slice& src) noexcept = default; diff --git a/test/arrays.cpp b/test/arrays.cpp index 367a735..ce064cc 100644 --- a/test/arrays.cpp +++ b/test/arrays.cpp @@ -106,6 +106,8 @@ i32 main() { static_assert(Same>); auto deduct5 = constv.slice(); static_assert(Same>); + auto deduct6 = Slice{deduct4}; + static_assert(Same>); v.pop(); assert(v.length() == 2);